WordPress.org

Forums

Post By Email
[resolved] Setting Custom Post Type (5 posts)

  1. listingwarebob
    Member
    Posted 1 year ago #

    Is it possible to have the ability to set the emails being read to a Custom Post Type (CPT) other than just 'Post'? I have a very specific way I'd like to use this plugin, but that feature is required first.

    http://wordpress.org/plugins/post-by-email/

  2. Kat Hagan
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    There's currently no way to do that, but I've added it to the list for the next version, which I'm working on over the next few weeks.

    Would it work better to specify the post type via shortcode in the email, or with a global option?

  3. listingwarebob
    Member
    Posted 1 year ago #

    I think the best way would be to have a global default post type, but then be able to set it dynamically via shortcode. That seems to cover most bases.

    Thanks for considering the addition!

  4. Barry Ceelen
    Member
    Posted 1 year ago #

    Hi,

    In the meantime it is possible to hook into the Post By Email plugin to make it save your email as a different post type. Something along these lines in your functions.php should work:

    add_action( 'publish_phone', array( $this, 'myfunctionprefix_set_post_type' ) );
    
    function myfunctionprefix_set_post_type( $post_ID ) {
    	$post = array(
    			'ID' => (int) $post_ID,
    			'post_type' => 'custom_post_type_slug_here'
    	);
    	wp_update_post( $my_post );
    }
  5. Kat Hagan
    Member
    Plugin Author

    Posted 1 year ago #

    Barry... you are awesome. :D Thanks for posting this!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic