Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Customer Area menu hack: Keep submenu open when editing the CPT.
Plugin Name: Customer Area menu hack
Description: Keep submenu open when editing the CPT.
To be used with the plugin
add_action( "admin_footer-post.php", 'b5f_highlight_menu_item' );
function b5f_highlight_menu_item()
// Not our post type, bail out
global $typenow;
if( !in_array( $typenow, array( 'cuar_private_file', 'cuar_private_page' ) ) )
<script type="text/javascript">
jQuery(document).ready( function($)
.addClass('wp-has-current-submenu wp-menu-open menu-top');
$('#toplevel_page_customer-area a[href="admin.php?page=customer-area"]:first')
.addClass('wp-has-current-submenu wp-menu-open');
if( !$('a[href="edit.php?post_type=<?php echo $typenow; ?>"]').parent().hasClass('current') )
$('a[href="edit.php?post_type=<?php echo $typenow; ?>"]').parent().addClass('current');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.