Skip to content

Instantly share code, notes, and snippets.

@wpmark
Created November 19, 2014 17:19
Show Gist options
  • Save wpmark/d9d1a461cdeb5073585c to your computer and use it in GitHub Desktop.
Save wpmark/d9d1a461cdeb5073585c to your computer and use it in GitHub Desktop.
WordPress Admin Menu Hierarchy Correction
<?php
function wpmark_menu_hierarchy_correction( $parent_file ) {
global $current_screen;
/* get the base of the current screen */
$screenbase = $current_screen->base;
/* if this is the edit.php base */
if( $screenbase == 'edit' ) {
/* set the parent file slug to the custom content page */
$parent_file = 'wpmark_admin_menu';
}
/* return the new parent file */
return $parent_file;
}
add_action( 'parent_file', 'wpmark_menu_hierarchy_correction', 999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment