Make Homepage a Category

by Debbie   Last Updated February 23, 2018 16:08 PM

How do I make my homepage to only show a category? I cant find any plugins that do this (which work) and the answers to similar questions have all sorts of varying code hacks. Am I overlooking something? I find it hard to believe there is no simple way to do this.

Using latest updated Woocommerce and Wordpress.



Answers 1


You can add a filter for pre_get_posts and customise $wp_query object for homepage.

It will be something like following code:

function my_function(){
    global $wp_query;
    if(is_home()){
        // add your queries to $wp_query object here.
    }
}
add_action( 'pre_get_posts', 'my_function' );
Aqib Ashef
Aqib Ashef
February 23, 2018 16:01 PM

Related Questions


display woocommerce all category title on home page

Updated February 18, 2016 01:03 AM


Hide posts belongs to few categories in homepage

Updated July 09, 2015 13:03 PM

Country Ways Content Show

Updated January 22, 2018 09:08 AM