This is because of a variable mismatch. Your function accepts $post_ID
, but you don’t actually use it. You’re instead trying to reference a global $post
object and doing your post format check with $post->ID
. With the XML-RPC request, this won’t work.
Rewrite your function to use get_post()
to fetch a post object from the passed-in ID:
function posse_twitter( $post_ID ) {
error_log('Executing posse_twitter()');
$post = get_post( $post_ID );
// check post format if necessary
if ( get_post_format( $post->ID ) != 'status' ) return;
error_log('posse_twitter() made it past format check');
...
}