Skip to content

Instantly share code, notes, and snippets.

@jazzsequence
Created September 2, 2015 20:11
Show Gist options
  • Save jazzsequence/e8121a91d8e3c46d12ad to your computer and use it in GitHub Desktop.
Save jazzsequence/e8121a91d8e3c46d12ad to your computer and use it in GitHub Desktop.
Change the parent item of a taxonomy to be a custom options page so the options page is highlighted when you are editing that taxonomy instead of the post type.
<?php
public function hooks() {
add_filter( 'parent_file', array( $this, 'highlight_admin_menu' ) );
}
public function highlight_admin_menu( $slug ) {
global $parent_file;
$screen = get_current_screen();
if ( 'edit-taxonomy_name' == $screen->id ) {
$parent_file = 'my_options_page_slug';
}
return $parent_file;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment