Created
November 18, 2017 13:45
-
-
Save kneupmedia/a845e96511a1d3c7bd7eabd7cc7df97c to your computer and use it in GitHub Desktop.
Add Custom Post Type to WordPress Feed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('pre_get_posts', 'add_cpt_to_main_feed'); | |
function add_cpt_to_main_feed($query){ | |
if ( $query->is_feed() ){ | |
$query->set( 'post_type', array('post', 'my_custom_post_type') ); | |
} | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment