2

I create product custom posts from an external data suscription, populating some custom fields and displaying product specifications automatically.

As there are a lot of these products, the manual review of each one is made after the custom post have been already published. And it is at that moment when I want my readers to see in the feed the product with the review.

The only way I have found so far is to modify the post GUID after the review so it appears again in the feed.

On the other hand in the codex we can read Never, ever, change the contents of the GUID column, under any circumstances. http://codex.wordpress.org/Changing_The_Site_URL#Important_GUID_Note

Is this circumstance a right one for modifying the guid or is there another way of serving these reviews again in the feed?

Another posibility would be to modify the query that control the wordpress main feed but haven't found the way to do it trying to follow these guidelines Adding posts of custom type into the main feed

function myfeed_request($qv) {
    if ( isset( $qv['feed'] ) ) {
    $qv['post_type'] = array('post', 'cars', 'bikes', 'trucks');
    //$qv['seccion'] = 'reviews';
    $qv['tax_query'] = array(
        'relation' => 'OR',
        array(
            'taxonomy' => 'section',
            'field' => 'slug',
            'terms' => array( 'reviews' )
        ),
        array(
            'taxonomy' => 'post_format',
            'field' => 'slug',
            'terms' => array( 'post' )
        )
    )

    }
    return $qv;
}
add_filter('request', 'myfeed_request');

Thanks a lot

4
  • why not wait until after the manual review to publish the post? that way you don't need to mess around with changing GUIDs
    – anu
    Oct 4, 2012 at 13:45
  • But I want my users to have access to the product specifications. I run an online comparator and need those hundreds of products to be online so users can compare between them.
    – antorome
    Oct 4, 2012 at 13:56
  • Did you read why the codex advises you not to change the GUID? The reason is the same as what you want to achieve (to not show your reviews againin the feeds). So obviously it's ok in your case, since this is what you want Oct 4, 2012 at 14:07
  • @OneTrickPony Of course I have read it and that is why I am proposing to do it. But it finishes the text saying that Never, ever, change... and was wondering if it is safe to do it and if wordpress is using it for any other purpose.
    – antorome
    Oct 4, 2012 at 14:18

2 Answers 2

1

There's a filter for that.

I use:

function ts_feed_spruce_get_the_guid($content) {
  // double ? is ok as guid is not a url
  // '&' gets esc_url'ed and doesn't work anyway
  $content .= '?d=' . get_the_modified_time('YmdHisT');
  return $content;
}
add_filter('get_the_guid', 'ts_feed_spruce_get_the_guid', 7);

Drop it in your theme functions.php or a plugin.

0

So there are two feeds - an external one that you use to create new custom posts, and then one you create with the reviewed products?

There is a bit of imprecision in the wording - do you actually create an RSS feed for your users or are you referring to the loop that displays the most recent posts?

If so, you could add a "reviewed" field that accepts a date and use that to determine whether to include the product in the feed that goes to the users. That would mean altering the query that creates the feed to include both new products and products that have been reviewed in the last X day(s)

2
  • Hi, don't pay attention to the external feed part. The point is just that I have hundreds of published custom posts (products). I also have a feed that is used by my users and myself for delivering rss-to-email campaigns. What I want is that my wordpress feed published those products when they have been reviewed. I have tried to modify the query but didnt manage to do it.
    – antorome
    Oct 5, 2012 at 8:49
  • I have edited the question
    – antorome
    Oct 5, 2012 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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