How to Display WordPress $hook_suffix as Admin Notice

x theme
(Last Updated On: July 10, 2014)

Hook Suffix is page in WordPress and that is generated everytime you add  a new admin menu, for example, add_submenu_page(), add_menu_page(), add_options_page(). These kind of functions returns a special value called Page Hook Suffix.

If you are looking for a way to use the hook_suffix later, register a hook on a particular page load-hook_suffix. Following is the code that will enable/disable hook_suffix when working on your WordPress project. Paste the code inside functions.php.

add_action( 'admin_notices', 'wps_print_admin_pagehook' );
function wps_print_admin_pagehook(){
global $hook_suffix;
if( !current_user_can( 'manage_options') )
<div><p><?php echo $hook_suffix; ?></p></div>

Related posts:

About the author


Leave a Reply

Your email address will not be published. Required fields are marked *