Randomize your posts Add this code snippet to your functions.php file. It jumps into the pre_get_posts hook and...
Query: exclude child categories of a specific category You can exclude children posts on your homepage of category 21 with this function. It...
Only show current author posts and content in wp-admin By default, WordPress allows Authors to see the titles of other users posts, unpublished drafts,...
Ignore sticky posts from the main query We use the pre_get_posts filter to modify the main query and set it to ignore...
Exclude sticky posts from main query Sticky posts are intended to be on top. This function excludes them from the main...
Limit CPTs per page on homepage What would we do without the pre_get_posts filter? Another handy WP snippet to customize the...
Search only in custom post types Limit the search query to a custom post type with this small snippet. We use...
modify custom post type query on archive page Set a custom order for posts in a custom post type on archive pages. ...
Limit search results to show x posts Change amount of posts shown on the search page - set here to 20