Make WordPress Core

Changeset 19158


Ignore:
Timestamp:
11/04/2011 05:41:38 PM (15 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-admin-bar.php

    r19130 r19158  
    7171                        $args = array_merge( array( 'parent' => func_get_arg(0) ), func_get_arg(2) );
    7272
    73                 // Ensure we have a valid ID and title.
    74                 if ( empty( $args['title'] ) || empty( $args['id'] ) )
     73                // Ensure we have a valid title.
     74                if ( empty( $args['title'] ) )
    7575                        return false;
     76
     77                if ( empty( $args['id'] ) ) {
     78                        _doing_it_wrong( __METHOD__, __( 'The menu ID should not be empty.' ), '3.3' );
     79                        $args['id'] = esc_attr( sanitize_title( trim( $args['title'] ) ) );
     80                }
    7681
    7782                $defaults = array(
Note: See TracChangeset for help on using the changeset viewer.