enter image description here

Here are these submenu items under the Posts menu

I inspected the code and found out that the markup of it is this

<ul class="wp-submenu wp-submenu-wrap">
  <li class="wp-submenu-head" aria-hidden="true">Posts</li>
  <li class="wp-first-item current"><a href="edit.php" class="wp-first-item current">All Posts</a></li>
  <li><a href="post-new.php">Add New</a></li>
  <li><a href="edit-tags.php?taxonomy=category">Categories</a></li>
  <li><a href="edit-tags.php?taxonomy=post_tag">Tags</a></li>
</ul>

What I would want to do is add a custom class my-custom-class on the

  • tags such that it would become like this

    <ul class="wp-submenu wp-submenu-wrap">
      <li class="wp-submenu-head" aria-hidden="true">Posts</li>
      <li class="wp-first-item current my-custom-class"><a href="edit.php" class="wp-first-item current">All Posts</a></li>
      <li class="my-custom-class"><a href="post-new.php">Add New</a></li>
      <li class="my-custom-class"><a href="edit-tags.php?taxonomy=category">Categories</a></li>
      <li class="my-custom-class"><a href="edit-tags.php?taxonomy=post_tag">Tags</a></li>
    </ul>

    Is there a way to add a custom HTML class name to admin screen submenu items?

    Read more here: How to add a custom HTML class name to admin screen submenu items?


    Solution:

    If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


    Wordpress related questions and answers: