Genx Blog

A Japanese web3 beatmaker. I make music and art.

How to include custom posts in post RSS in WordPress

riswan ratta EWNOvzjMtFk unsplash scaled
Genx Avatar
Share This:

Put the following code in functions.php. For example, if it is a slug for a custom post type called ‘product’ or ‘wpdmpro’, enter it as follows. Replace slug with your own custom post type slug.

/* Include custom posts in post RSS */
add_filter( 'pre_get_posts', 'my_custom_posts_rss' );
function my_custom_posts_rss( $query ) {
if ( is_feed() )
$query->set( 'post_type', array( 'post', 'product', 'wpdmpro' ) );
return $query;
}

—

by

in

Last Updated:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

seven − 5 =