Get posts by category or author
I used the following in my child theme ‘functions.php’ to get posts by category name. You can also use category ID number but that didn’t work for me. add_action(‘pre_get_posts’, ‘ad_filter_categories’); function ad_filter_categories($query) { if ($query->is_main_query() && is_home()) { $query->set(‘category_name’,’tips’); } }