Skip to content

Instantly share code, notes, and snippets.

@GaryJones
Created December 14, 2011 19:43
Show Gist options
  • Save GaryJones/1478136 to your computer and use it in GitHub Desktop.
Save GaryJones/1478136 to your computer and use it in GitHub Desktop.
has_meta_boxes()
<?php
/**
* Helper function to determine if a meta boxes exists for a given context on
* a given page.
*
* @global array $wp_meta_boxes
*
* @param string $page Name of the admin page
* @param string $context Name of the meta box context
* @return boolean True if given context on the given page has meta boxes. False otherwise
*/
function has_meta_boxes( $page, $context ) {
global $wp_meta_boxes;
if ( isset( $wp_meta_boxes ) && isset( $wp_meta_boxes[$page] ) && isset( $wp_meta_boxes[$page][$context] ) )
return true;
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment