If an empty menu ID is passed, derive it from the title and issue a _doing_it_wrong() notice. see #18197
git-svn-id: https://develop.svn.wordpress.org/trunk@19158 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
04b16d0042
commit
242b3f48e4
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue