Make WordPress Core

Changeset 49856


Ignore:
Timestamp:
12/21/2020 05:09:50 PM (6 years ago)
Author:
johnbillion
Message:

XML-RPC: Fix a type error when requesting the menu field of a taxonomy.

Fixes #51493

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r49385 r49856  
    767767
    768768                if ( in_array( 'menu', $fields, true ) ) {
    769                         $_taxonomy['show_in_menu'] = (bool) $_taxonomy->show_in_menu;
     769                        $_taxonomy['show_in_menu'] = (bool) $taxonomy->show_in_menu;
    770770                }
    771771
  • trunk/tests/phpunit/tests/xmlrpc/wp/getTaxonomy.php

    r48937 r49856  
    6161                $this->assertSame( (array) $taxonomy->object_type, $result['object_type'], 'object_types' );
    6262        }
     63
     64        /**
     65         * @ticket 51493
     66         */
     67        function test_taxonomy_with_menu_field_specified() {
     68                $this->make_user_by_role( 'editor' );
     69
     70                $fields = array(
     71                        'menu',
     72                );
     73
     74                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category', $fields ) );
     75                $this->assertNotIXRError( $result );
     76                $this->assertTrue( $result['show_in_menu'] );
     77        }
    6378}
Note: See TracChangeset for help on using the changeset viewer.