mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-03 11:31:39 +00:00
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:
@@ -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'] );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user