Created
October 3, 2016 11:32
-
-
Save thesadoo/94e0cdfdf3732af885635e46e2c670e3 to your computer and use it in GitHub Desktop.
Add WooCommerce products to website's feed along posts
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
<?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