Skip to content

Instantly share code, notes, and snippets.

@thesadoo
Created October 3, 2016 11:32
Show Gist options
  • Save thesadoo/94e0cdfdf3732af885635e46e2c670e3 to your computer and use it in GitHub Desktop.
Save thesadoo/94e0cdfdf3732af885635e46e2c670e3 to your computer and use it in GitHub Desktop.
Add WooCommerce products to website's feed along posts
<?php
# ADD PRODUCTS TO THE FEED
add_action('pre_get_posts', 'add_products_to_the_feed');
function add_products_to_the_feed($query){
if( is_feed() && is_main_query() ){
$query->set('post_type', array('post', 'product'));
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment