So i got the RSS feed which output some custom post types, but the GUID looks bad to me, it's like:


The reason i want to change this is that I don't need people to know it's Wordpress or to see my custom post type name (this is very important in this project)

Is there a filter or hook to rewrite this?



The feed template files call the_guid(), which calls get_the_guid(), which has a filter named (surprisingly) get_the_guid. You can hook into this filter to change the output. The filter only gets the current GUID, not the post ID, so look this up in the global variable if you need it.

add_filter( 'get_the_guid', 'wpse17463_get_the_guid' );
function wpse17463_get_the_guid( $guid )
    return 'http://example.com/guid/' . sha1( $guid );

See also this Trac ticket which proposes to change the current GUID format to a more unique hash.


I didn't get where you see that GUID. But if it's the title link, you can try:

function my_permalink($permalink) {
    global $wp_query;
    $permalink = get_permalink( $wp_query->post->ID );
    return $permalink;

add_filter('the_permalink_rss', 'my_permalink');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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