If an empty menu ID is passed, derive it from the title and issue a _doing_it_wrong() notice. see #18197

git-svn-id: http://svn.automattic.com/wordpress/trunk@19158 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2011-11-04 17:41:38 +00:00
parent 56e8457205
commit e4ae15aefe
1 changed files with 7 additions and 2 deletions

View File

@ -70,10 +70,15 @@ class WP_Admin_Bar {
if ( func_num_args() >= 3 && is_string( func_get_arg(0) ) )
$args = array_merge( array( 'parent' => func_get_arg(0) ), func_get_arg(2) );
// Ensure we have a valid ID and title.
if ( empty( $args['title'] ) || empty( $args['id'] ) )
// Ensure we have a valid title.
if ( empty( $args['title'] ) )
return false;
if ( empty( $args['id'] ) ) {
_doing_it_wrong( __METHOD__, __( 'The menu ID should not be empty.' ), '3.3' );
$args['id'] = esc_attr( sanitize_title( trim( $args['title'] ) ) );
}
$defaults = array(
'id' => false,
'title' => false,