Make WordPress Core

Ticket #18197: 18197-doing-it-wrong.diff

File 18197-doing-it-wrong.diff, 848 bytes (added by ryan, 13 years ago)
  • wp-includes/class-wp-admin-bar.php

     
    7070                if ( func_num_args() >= 3 && is_string( func_get_arg(0) ) )
    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;
    7676
     77                if ( empty( $args['id'] ) ) {
     78                        _doing_it_wrong( __FUNCTION__, __( 'The menu ID should not be empty.' ), '3.3' );
     79                        $args['id'] = esc_attr( sanitize_title( trim( $args['title'] ) ) );
     80                }
     81
    7782                $defaults = array(
    7883                        'id'       => false,
    7984                        'title'    => false,