Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I recently discovered ifttt.com and have been working on creating a few ifttt tasks for my Kansas City Royals website. I am in the process of adding the ability for fans to make quick posts, such as YouTube videos, links, photos, etc.

These FanPosts are each a custom post type. I would like to set up a few feeds to post automatically to the custom post type "FanPost".

I love that ifttt can automatically post to WordPress, but I do not want to post simple video embeds, links and photos to the main articles (Posts) section of the website, instead, I want to post to the custom post type(s).

I have been searching for a few days, but I cannot find any documentation either way if this is possible or not.


share|improve this question

1 Answer 1

up vote 5 down vote accepted

As the only way ifttt.com can post to Wordpress, is using the XML-RPC API, and that API currently doesn't support supplying custom post type while calling insert post methods(will support from 3.4), you can make use of the filter wp_insert_post_data. I accomplished that last month while building a hack. Here is a hack that would work the way you want, just add this to your functions.php file -

function redirect_xmlrpc_to_custom_post_type ($data, $postarr) {
    // This function detects a XML-RPC request and modifies it before posting

    $p2_custom_post_type = 'FanPost'; // Define your Custom post type

    if (defined('XMLRPC_REQUEST') || defined('APP_REQUEST')) {
        $data['post_type'] = $p2_custom_post_type; // sets the request post type to custom post type instead of the default 'Post'.
        return $data;
    return $data;

// Add the filter
add_filter('wp_insert_post_data', 'redirect_xmlrpc_to_custom_post_type', 99, 2);

Remember, this filter will detect any insert post request via the XML-RPC API and insert them to FanPost type. Be it from ifttt.com or anywhere else.

share|improve this answer
Thanks. This answers my question exactly as I asked, but I have a follow up question based on your answer. Is there a way to add multiple types of custom posts? I assume from your reply that it is not yet possible. Thanks for your help! –  Travis Pflanz May 5 '12 at 20:37
@TravisPflanz Nope. I had to manually change this code and work every time I wanted to. For my case, I needed to import a bunch of data every time I ran the code. So manually editing worked for me. –  Bibhas May 5 '12 at 20:53
WordPress 3.4 is here. Check out their API. –  Bibhas Jun 25 '12 at 9:05
Just had a thought: you can specify what category your posts from IFTTT will be - what if you created a custom loop/styling based on the category chosen? if ( $cat_from_ifttt = $category ) { //choose custom loop/styling? } It's not exactly custom_post_types, but it's a possible workaround? –  joshmax Nov 16 '12 at 16:42
@Bibhas Is the 99, 2 in your code specific to your instance... or is the post_type = 'post_type_name' the only change necessary here? Thanks. –  earshot Oct 1 at 16:33

protected by Al E. Oct 2 at 0:06

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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