How to include custom posts in post RSS in WordPress

riswan ratta EWNOvzjMtFk unsplash scaled

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;
}

Genx

in

About The Author

Genx

Born in 1982 in Japan, he is a Japanese beatmaker and music producer who produces experimental hiphop beats. He is the owner of Genx Records. Because he grew up internationally, he understands English. His hobbies are muscle training, artwork creation, website customization, and web3. He also loves Korea.

Website: genxrecords.xyz

Share This Post:


Comment

Leave a Reply

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

19 + twenty =

Webmention: Have you posted a response to this article? Let me know the URL: