2

I have a scenario where we would like to post to our blog via email. However, it needs to be to a custom post type. I've done a bit of research but haven't found any examples or ideas on how to do this.

Any help would be appreciated.

5

When a post is submitted by email and published WordPress Runs an action hook named 'publish_phone' so you can get the post there and change its type like this:

add_action('publish_phone','custom_type_by_mail');
function custom_type_by_mail($post_id){
    $p = get_post($post_id,'ARRAY_A');
    $p['post_type'] = "YOUR_CUSTOM_TYPE_NAME_HERE";
    wp_update_post($p);
}

Probably not the smartest way but it does work and its simple.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.