Add custom post type to rss feed [WordPress]


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. add_filter( 'pre_get_posts', 'my_get_posts' );
  2. function my_get_posts( $query ) {
  3. if ( is_feed() )
  4. $query->set( 'post_type', array( 'post', 'snippet' ) );
  5. return $query;
  6. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.