Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'd like to optionally replace some RSS item titles with a headline meta field I've added to certain post types.

I have the post types showing up in the feed using:

function myfeed_request($qv) {
  if (isset($qv['feed']) && !isset($qv['post_type']))
    $qv['post_type'] = array('post', 'interviews', 'reviews');
  return $qv;
}
add_filter('request', 'myfeed_request');

But I've searched around and can't figure out how to replace the title. Any ideas?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Something like this (not tested):

add_filter('the_title_rss', 'custom_feed_title');

function custom_feed_title($title) {

    $headline = get_post_meta(get_the_id(), 'headline', true);

    if (!empty($headline))
        return $headline;

    return $title;
}
share|improve this answer
    
Perfection. Thanks! :o) –  robalan Mar 5 '11 at 21:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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