0

I added a direct link to a page in the admin menu with the add_menu_page function. Once I click on the link, the About page edit screen opens, great. The problem though, i want the About menu item i added to be higlighted in blue.

add_menu_page( 'About1', 'About', 'edit_posts', 'post.php?post=87&action=edit', '', 'dashicons-editor-help', 7 );

enter image description here

1 Answer 1

0
add_filter( 'parent_file', 'parent_file_hover' );

function parent_file_hover( $parent_file )   {
    global $pagenow;
    if ( $pagenow == 'post.php')
        $parent_file = "post.php?post={$_REQUEST['post']}&action=edit";
    elseif($pagenow == 'post-new.php')
        $parent_file = "post-new.php?post_type={$_REQUEST['post_type']}";
    return $parent_file;
}

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.