Make WordPress Core

Changeset 46678


Ignore:
Timestamp:
11/08/2019 01:17:35 PM (5 years ago)
Author:
johnbillion
Message:

Toolbar: Un-deprecate the WP_Admin_Bar::add_menu() method.

This is only a wrapper for the add_node() method, but it's in widespread use both in core until [46642] and in thousands of plugins and themes. Deprecating it would have made sense when #19647 was originally opened but that's no longer the case.

Props whyisjake

Fixes #19647

Location:
trunk
Files:
2 edited

Legend:

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

    r46642 r46678  
    9191     */
    9292    public function add_menu( $node ) {
    93         _deprecated_function( __METHOD__, '5.4.0', __CLASS__ . '::add_node()' );
    9493        $this->add_node( $node );
    9594    }
     
    104103     */
    105104    public function remove_menu( $id ) {
    106         _deprecated_function( __METHOD__, '5.4.0', __CLASS__ . '::remove_node()' );
    107105        $this->remove_node( $id );
    108106    }
  • trunk/tests/phpunit/tests/adminbar.php

    r46642 r46678  
    347347
    348348    /**
    349      * @ticket 19647
    350      */
    351     public function test_deprecated_menu_methods() {
    352         $admin_bar = new WP_Admin_Bar();
    353         $node_data = array( 'id' => 'test-node-19647' );
    354 
    355         // Test add_menu() deprecation.
    356         $this->setExpectedDeprecated( 'WP_Admin_Bar::add_menu' );
    357         $admin_bar->add_menu( $node_data );
    358         $node_test = $admin_bar->get_node( 'test-node-19647' );
    359         $this->assertNotNull( $node_test );
    360 
    361         // Test remove_menu() deprecation.
    362         $this->setExpectedDeprecated( 'WP_Admin_Bar::remove_menu' );
    363         $admin_bar->remove_menu( 'test-node-19647' );
    364         $node_test = $admin_bar->get_node( 'test-node-19647' );
    365         $this->assertNull( $node_test );
    366     }
    367 
    368     /**
    369349     * @ticket 22247
    370350     */
Note: See TracChangeset for help on using the changeset viewer.