Viewing 1 to 2 of 2 items
Tag Archives: pre_get_posts

Modifying queries with pre_get_posts

Written by Remi Corson. you can for example query only posts from a specific type and with a custom meta field key equal to a determined value. In the code below, we are targeting only custom post type called “portfolio” where meta key “project_type” is set to “design”, that’s a typical query that can be  Full Article…

0

Remove a category from the front-page.php

The correct way to do this is to make use of pre_get_posts which change the query vars just before the main query is executed. Here is an example from the codex to exclude categories from the home page/blog page. For a full list of available parameters and values that you can use with pre_get_posts, visit  Full Article…

0