How To Post WordPress Custom Post Types to Twitter via IFTTT

I have my wordpress site. Which has the normal "post" and a custom post type "download", I Currently use IFTTT, (If This Then That Service) to post my wordpress posts to Twitter.

The IFTTT recipe works perfectly for my posts, and tweets as soon as I publish any post. You can check my site https://milyin.com, and my twitter account is https://twitter.com/milyincrealtors/

The problem is that, this works only for normal wordpress posts. I searched IFTTT for applets to include custom post types, that didn't work, and i can not find a solution on stack exchange also.

How can i use IFTTT, to tweet any new post of post type 'download'

I love IFTTT, and i don't want any plugins that slow down my site. So please provide me with the code, that ensures that my IFTTT applet is triggered for this custom post type also.

Topic social-sharing xml-rpc php plugins custom-post-types Wordpress

Category Web


IFTTT works from RSS feed, simply including your post in wordpress RSS feed can do the trick...

function add_cpt_to_loop_and_feed( $query ) {
    if ( is_home() && $query->is_main_query() || is_feed() )        
    $query->set( 'post_type', array( 'post', 'download' ) );    
    return $query;
    }

This is the off topic question. But the answer is yes it is possible.

In IFTTT we can use the Feed applet like "Feed to Tweet".

So, Just create the the Feed applet with your custom post type feed URL.

WordPress generates the feed URL for each post type. You can get it as below:

https://yourwebsite.com/feed/?post_type={post-type-slug}

E.g. Feed URL of custom post type "Shortcode" is

https://wpdigits.com/feed/?post_type=shortcode

See the Shortcode post type feed URL.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.