Use the pre_get_posts
action to modify the main query. Place this in your functions.php
file:
function wpa71787_home_tag_query( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'tag', 'reviews' );
}
}
add_action( 'pre_get_posts', 'wpa71787_home_tag_query' );
You can set any valid parameters of WP_Query
with this method.
Edit, secondary query excluding tagged posts, use tag ID:
$query = new WP_Query( array( 'tag__not_in' => array( 42 ) ) );
while( $query->have_posts() ):
$query->the_post();
// loop stuff
endwhile;
Related Posts:
- Category archive page – loop through posts of certain tag (with pagination) – pre_get_posts
- Is there a reason I cannot get the current category in a loop?
- Display all categories but only if they have posts in them that have a specific tag assigned
- How to add an empty entry to masonry?
- Loops in category description
- Can’t custom taxonomies have same terms (slugs) as categories?
- Should category.php and The Loop be used if the query needs to be customizable?
- How do the ‘tag’ and ‘category’ (default) taxonomies do ‘save_post’ action?
- Exclude the category from the WordPress loop
- Checklist of selected categories
- get_field not displaying my custom field value
- Sort posts by tags in category pages
- Randomise results from a category page?
- How to search for categories and/or tags?
- How to get the url to tag & category base set by the user?
- Show div only if post is in specific category
- Filter categories using tags
- Sticky posts on home page, search, tag and archives without plugin
- How to show a category post to a specific registered user
- In the tag archive – display count of posts for each category they belong to
- Is it possible to disable certain user roles from creating tags?
- Root level category, tag, author and archive pages to work
- Listing all posts from current category on page
- Display one latest post from multiple categories
- How do I get the total number of categories in a list of search results?
- Remove Categories and Tags from Admin Dashboard
- Remove Archive Headline and Archive Intro Text fields on category and tag archive pages in WordPress Admin with Genesis framework
- Display products for a category, sorted by post_excerpt
- Listing Parent, Child and GrandChild Categories and then the PostTitles on Page Template !
- Help with multiple dropdown tags search
- Hide tag and category boxes from the post editor
- a-z list, categories and sub categories in loop
- Categories: A Greenhorn Question on Strategy (Not Code)
- Warning: sizeof (): Parameter must be an array or an object that implements Countable, On products pages
- How to loop only categories without posts (+ show category featured image with acf) [closed]
- Additional featured post on first page
- Making a tourism information website [closed]
- Show all posts for a specific category/author
- How get permalink for the current category or tag?
- create a page which displays a list of categories title+ short description?
- Changing permalink from /postname/ to category/postname/
- Query Posts Exclude Entire Category
- Class active for Archive link – looped out
- Site search needs to find posts for category topic AND Tag or keyword thats not in the post
- Pagination is not working properly in Product Category/Tag pages
- Inside a loop, how to change CSS class based on category name?
- Categories list loop – add separator every 3 categories [closed]
- Tag page only display 10 posts
- Trying to get variables in hacked category dropdown
- How to Remove a Title from All Category and Tags Page?
- category__not_in and id values from variable
- How can I display tags as categories?
- Do not show sub categories in the loop on archive-product.php
- How to get an array with all categories and corresponding names?
- Echo text using is_tag
- Allow user to select categories that will display in post loop
- Insert HTML content in WP Query at specific point
- Two Sections on Woocommerce Catergory Page [closed]
- Getting the Most Recent Posts from Multiple Categories
- Display subcategories in dropdown
- Display category title and three latest post inside the category
- Use blog as base for tags and categories
- Show multiple categories in query using redux framework variable
- How to store category and tags separatly on wordpress?
- Limit Loop to One Category
- Filter Category Loop Dynamically
- Conditional category query breaking?
- Problem: retrieving parent category’s first post
- What is the best way to add an advanced / intermediate / beginner tag to a post
- Category name for all posts getting assigned to a single random post
- Category post count is not correct
- Include last post date in get_categories loop
- How to add tags under categories
- Add Post Categories in Post Tags Field Programmatically
- How to get specific (grand parent) category of current post?
- Custom Loop with certain number of one category
- how tho change number of posts in loop from specific categories
- Template category.php with page (no posts)
- Automatically create tags and merge with categories
- error in specific category loop
- loop in single.php of the same category
- Hide a category/posts from the homepage in wp
- How to assign Categories and tags inside the TinyMCE Editor for each Image?
- Search by tag, category and author without plugin
- Limit Category/Tag Dropdown To blog_id in Multisite Install With Global Categories/Tags
- Trying to display all posts in a category
- Tag Menu items based on their categories
- How to add an “All” category to the tag cloud?
- Display Taxonomies in loop with template args
- How to exclude a specific categogy from a custom page template
- Unable to get all tags from specific categories
- Secondary loop cuts off at 10 posts?
- How to get multiple loop in category.php, my scripts becomes madness
- Custom Category Page Not Working [duplicate]
- altering theme – content generated by PAGES not PORTFOLIO
- How do i add custom post types to this query?
- Custom loop by url
- Do not show all post from all categories, just show posts from category in current loop
- IF have_posts contains posts from a certain category
- In my wordpress admin panel Suddenly The Category, tag and featured Image Option are not showing