I have implemented a Custom menu item in my wordpress dashboard using the following command in the functions.php

function create_menu() {
    $settings_page = add_menu_page('Edit_Post_69', 'Edit_Post_69', 'add_users', '/post.php?post=69&action=edit', '', get_stylesheet_directory_uri() . '/editicon.png', 2);

This works great and has added the icon into the dashmenu, included the icon and when clicked, takes me to the Edit Post page on post #69.

enter image description here

The problem I am facing is that even though I have clicked my custom link, the page it is currently on is the Edit Post page, this causes the Highlighted arrow to be on the Post section rather than my custom section as in the image below.


What I need is for my custom item to be highlighted as well, I have tried looking at filters and dug out _wp_menu_output, the idea being to filter the html and change the id class of the item to give it its highlighting.

Can anyone point me in the right direction of resolving this issue?

  • Welcome to WPSE & +1 for the nicely formed Question!
    – brasofilo
    Jul 15, 2012 at 15:33

1 Answer 1


The probability is high that no hook will exist for that...

But it can be solved with jQuery:

add_action( 'admin_head-post.php', 'wpse_58567_highlight_menu_item' );

function wpse_58567_highlight_menu_item()
    global $post;

    if( 69 != $post->ID )

        <script type="text/javascript">
            jQuery(document).ready( function($) {
  • 1
    That is perfect, I have been trying to come up with a solution for so long now! Thanks for taking the time to reply Jul 15, 2012 at 15:55
  • I am now trying to move on with this function and convert it so that it uses the post name instead of the Id. I have created a new question at wordpress.stackexchange.com/questions/59050/… - Any chance you could look in? Jul 19, 2012 at 16:21
  • Thanks Brasofilo, Very active member of the WP community! I see your name everywhere those days ;) Anyway, if I have to resort to javascript I will but... isn't there a "non-hacky" way to do this now (meaning 2 years later)? Aug 14, 2014 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.