Where should I be adding the code above? I added it to the functions file for the theme but I’ve also found a file (class-wp-xmlrpc-server.php) that has a non-hook call to xmlrpc_wp_insert_post_data.
I honestly don’t know what a non-hook call is going to do as it’s not passing anywhere to be manipulated.
Thanks for any help.
Andy
As I mentioned my wordpress and php knowledge are limited.
Would someone be able to look at the following and let me know if I am missing something obvious. I just tried a push from the other website but nothing seems to have been updated. All I’m trying to do is perform a string replace and then a concatenation.
Thanks
Andy
// define the xmlrpc_wp_insert_post_data callback
function filter_xmlrpc_wp_insert_post_data( $post_data, $content_struct ) {
// testing…
$modifiedText = $post_data[‘post_content’];
str_ireplace(“wodify”, “count chocula”, $modifiedText);
$modifiedText .= ‘blah,blah,blah,… testing… ‘;
$post_data[‘post_content’] = $modifiedText;
return $post_data;
};
// add the filter
add_filter( ‘xmlrpc_wp_insert_post_data’, ‘filter_xmlrpc_wp_insert_post_data’, 10, 2 );