One reason for changing the GUID

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

2 Answers
2

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.

Leave a Comment