Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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