Skip to content

Instantly share code, notes, and snippets.

@johnpbloch
Created March 27, 2013 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnpbloch/5253759 to your computer and use it in GitHub Desktop.
Save johnpbloch/5253759 to your computer and use it in GitHub Desktop.
Get the hook suffix without an object or class
<?php
namespace JPB\Some_Plugin;
function get_hook_suffix() {
return apply_filters( 'jpb.some_plugin.get_hook_suffix', '' );
}
function register_page() {
$hook_suffix = add_submenu_page( /* Arguments */ );
add_filter( 'jpb.some_plugin.get_hook_suffix', function() use ( $hook_suffix ) {
return $hook_suffix;
} );
}
add_filter( 'admin_menu', '\JPB\Some_Plugin\register_page' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment