I'm posting to a Wordpress blog using an email and I want to filter everything before the [title shortcode. I've been trying a few things but no luck. This is what I have:
<?php
function filter_handler( $data , $postarr ) {
// do something with the post data
$post_content = $postarr['post_content'];
strstr($post_content, '[title');
}
add_filter( 'wp_insert_post_data', 'filter_handler', '99', 2 );
Figured it out
function changePost($data, $postarr) {
$data['post_content'] = strstr( $postarr['post_content'], '[title' );
return $data;
}
add_filter('wp_insert_post_data','changePost','99',2);