Skip to content
Snippets Groups Projects
Commit 582a23f6 authored by Mohammad Jangda's avatar Mohammad Jangda
Browse files

xmlrpc-client: only send taxonomy data if supported.

If the post_type supports tags and categories, we should send the data. Otherwise, ignore it.
parent 6658a431
No related branches found
No related tags found
No related merge requests found
...@@ -59,10 +59,13 @@ class WP_XMLRPC_Client extends WP_HTTP_IXR_Client implements WP_Client { ...@@ -59,10 +59,13 @@ class WP_XMLRPC_Client extends WP_HTTP_IXR_Client implements WP_Client {
$args['post_date_gmt'] = $this->convert_date_gmt( $post['post_date_gmt'], $post['post_date'] ); $args['post_date_gmt'] = $this->convert_date_gmt( $post['post_date_gmt'], $post['post_date'] );
// @TODO extend this to custom taxonomies // @TODO extend this to custom taxonomies
$args['terms_names'] = array( $args['terms_names'] = array();
'category' => wp_get_object_terms( $post_ID, 'category', array('fields' => 'names') ),
'post_tag' => wp_get_object_terms( $post_ID, 'post_tag', array('fields' => 'names') ) if ( is_object_in_taxonomy( $post['post_type'], 'category' ) )
); $args['terms_names']['category'] = wp_get_object_terms( $post_ID, 'category', array('fields' => 'names') );
if ( is_object_in_taxonomy( $post['post_type'], 'post_tag' ) )
$args['terms_names']['post_tag'] = wp_get_object_terms( $post_ID, 'post_tag', array('fields' => 'names') );
// post meta // post meta
$args['custom_fields'] = array( $args['custom_fields'] = array(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment