WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using Wordpress 3, creating write panels with Magic Fields, how do I add custom fields to my RSS feed?

For example, I have an 'image of the day' write panel, with a custom field for the photo credit. How can I include all that as part of my feed?


share|improve this question

you can use something like this

function feed_magic_fields( $content ) {
  global $post, $id;

  if ( !is_feed() )
    return $content;

  // is feed
  $date = get('date_event');
  if( $date)
    $content .= $date

  return $content; 

add_filter( 'the_content', 'feed_magic_fields' );
share|improve this answer
thanks for adding some code, that's basically what I meant no need to global $post, $id btw. – hakre Aug 27 '10 at 21:21

You can hook into your feed with the according filters and then add your stuff.

Basically that codex page suggests (and that's still valid, you find the feed templates inside /wp-includes/, the files start with feed-) that you hook into the_content and you check with is_feed() if you need to modify the content for the feed.

To save you some hassles, you can register your whole plugin to activate on the do_feed_rss2 (or whichever you use) hook, so you do not need to check for is_feed().

The contents of magic fields (custom fields to be precise) can be read out with existing functions, you find the documentation here: Custom Fields.

share|improve this answer

Your Answer


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.