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

Fixes #51493


git-svn-id: https://develop.svn.wordpress.org/trunk@49856 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2020-12-21 17:09:50 +00:00
parent b43ebc51e8
commit 51f9a54c9d
2 changed files with 16 additions and 1 deletions
+1 -1
View File
@@ -766,7 +766,7 @@ class wp_xmlrpc_server extends IXR_Server {
}
if ( in_array( 'menu', $fields, true ) ) {
$_taxonomy['show_in_menu'] = (bool) $_taxonomy->show_in_menu;
$_taxonomy['show_in_menu'] = (bool) $taxonomy->show_in_menu;
}
if ( in_array( 'object_type', $fields, true ) ) {
@@ -60,4 +60,19 @@ class Tests_XMLRPC_wp_getTaxonomy extends WP_XMLRPC_UnitTestCase {
$this->assertSame( (array) $taxonomy->cap, $result['cap'], 'capabilities' );
$this->assertSame( (array) $taxonomy->object_type, $result['object_type'], 'object_types' );
}
/**
* @ticket 51493
*/
function test_taxonomy_with_menu_field_specified() {
$this->make_user_by_role( 'editor' );
$fields = array(
'menu',
);
$result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category', $fields ) );
$this->assertNotIXRError( $result );
$this->assertTrue( $result['show_in_menu'] );
}
}