I have a service that puts a daily post to my blog via XML-RPC. It doesn't offer me any control of what category it goes into so I want to just add a filter/hook to add the category I want into the incoming post data:
add_action ('xmlrpc_call', 'check_xmlrpc_call' );
function check_xmlrpc_call( $method )
{
if( 'wp.newPost' === $method )
{
add_filter( 'xmlrpc_wp_insert_post_data', 'add_xmlrpc_category_post_data' );
}
}
function add_xmlrpc_category_post_data( $post_data )
{
//not sure how to add category to the post data :(
return $post_data;
}
I think something like this in my functions.php
would work? I just am not sure the correct format to add a category to the post data?
Maybe this?
$post_data['terms'] = array('category' => array(207))