mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 17:48:01 +01:00
Move convert_to_screen() back to template.php to avoid fatal errors with plugins and themes that direct include template.php into the front end. Flag this bad behavior with _doing_it_wrong(). Props nacin. fixes #19342
git-svn-id: http://svn.automattic.com/wordpress/trunk@19428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
da541dccac
commit
ff358379c9
@ -107,18 +107,6 @@ function get_hidden_meta_boxes( $screen ) {
|
||||
return apply_filters( 'hidden_meta_boxes', $hidden, $screen, $use_defaults );
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a screen string to a screen object
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen.
|
||||
* @return WP_Screen Screen object.
|
||||
*/
|
||||
function convert_to_screen( $hook_name ) {
|
||||
return WP_Screen::get( $hook_name );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add contextual help text for a page.
|
||||
*
|
||||
|
@ -1796,3 +1796,20 @@ final class WP_Internal_Pointers {
|
||||
}
|
||||
|
||||
add_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) );
|
||||
|
||||
/**
|
||||
* Convert a screen string to a screen object
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen.
|
||||
* @return WP_Screen Screen object.
|
||||
*/
|
||||
function convert_to_screen( $hook_name ) {
|
||||
if ( ! is_admin() ) {
|
||||
_doing_it_wrong( 'convert_to_screen(), add_meta_box()', __( "Likely direct inclusion of wp-admin/includes/template.php in order to use add_meta_box(). This is very wrong. Hook the add_meta_box() call into the add_meta_boxes action instead." ), '3.3' );
|
||||
return (object) array( 'id' => '_invalid', 'base' => '_are_belong_to_us' );
|
||||
}
|
||||
|
||||
return WP_Screen::get( $hook_name );
|
||||
}
|
Loading…
Reference in New Issue
Block a user