I have created a custom post-type called "event".

For this custom post-type I created an advanced custom field called "event_date".

Now I am trying to display the list of my events in a RSS feed.

I figured out how to display custom fields and featured image in my RSS feed but I cant figure out how to re-arrange the feed content according to the event_date and not the date when the post was created...

Can someone help me with a URL string query for RSS feed or a simple line I can add to my functions.php?

Thanks a lot in advance!

1 Answer 1


hope this code will helpful for you

    $args = array(
  'post_type'         =>'event',
  'post_status'       => 'publish',
  'posts_per_page'    => -1,
  'meta_key'          => 'event_date',
  'orderby'           => 'meta_value_num',
  'order'             => 'DESC'
  • Thank you so much for your help. I am a designer not a coder and whereas I do see how helpful this code is I have no idea where to put it and how to query it.. Do I put it into functions.php? And then what to write in rss url string? This is how RSS feed looks like right now grid.tokyo.jp/feed/?post_type=event Dec 3, 2019 at 5:40
  • you can put it in inside a template where the event post want to display Dec 3, 2019 at 5:43
  • In this template you can load your rss wp_query ----------//code---------- function create_my_customfeed() { load_template( TEMPLATEPATH . 'your-custom-feed.php'); // You'll create a your-custom-feed.php file in your theme's directory } add_action('do_feed_customfeed', 'create_my_customfeed', 10, 1); refered link katz.co/648 Dec 3, 2019 at 6:24

Your Answer

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

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