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

Don't send non-string objects in post meta as serialized strings.

Otherwise they get stored as strings at the endpoint.
parent fb27a330
No related branches found
No related tags found
No related merge requests found
......@@ -216,25 +216,25 @@ class WP_XMLRPC_Client extends WP_HTTP_IXR_Client implements WP_Client {
$all_post_meta = get_post_custom( $post_id );
$blacklisted_meta = $this->_get_meta_blacklist();
foreach ( (array) $all_post_meta as $post_meta_key => $post_meta_value ) {
foreach ( (array) $all_post_meta as $post_meta_key => $post_meta_values ) {
if ( in_array( $post_meta_key, $blacklisted_meta ) || preg_match( '/^_?syn/i', $post_meta_key ) )
continue;
// TODO: for single, string values, don't send as an array
if ( is_array( $post_meta_value ) && 1 == count( $post_meta_value ) )
$post_meta_value = array_shift( $post_meta_value );
foreach ( $post_meta_values as $post_meta_value ) {
$post_meta_value = maybe_unserialize( $post_meta_value ); // get_post_custom returns serialized data
$custom_fields[] = array(
'key' => $post_meta_key,
'value' => $post_meta_value,
);
$custom_fields[] = array(
'key' => $post_meta_key,
'value' => $post_meta_value,
);
}
}
$custom_fields[] = array(
'key' => '_masterpost_url',
'value' => $post->guid,
);
return $custom_fields;
}
......@@ -403,4 +403,4 @@ class WP_XMLRPC_Client extends WP_HTTP_IXR_Client implements WP_Client {
// TODO: Implement get_posts() method.
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment