Question

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

Was it helpful?

Solution

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; }

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top