Since you’re working with the tag archive index page query, this really won’t be all that difficult. You simply need to filter the query parameters at pre_get_posts
, using your criteria.
For example:
function wpse137627_pre_get_posts( $query ) {
// If this is the tag archive index,
// and is the main query
if ( is_tag() && $query->is_main_query() ) {
// Limit the query to the specified category
// Change '123' (int) to the appropriate category ID
$query->set( 'cat', 123 );
}
}
add_action( 'pre_get_posts', 'wpse137627_pre_get_posts' );
You can also pass the category slug, using $query->set( 'category_name', 'cat-slug' )
.
Related Posts:
- how to add tags to post in the Loop?
- Get current taxonomy and display query accordingly
- Prevent duplicate pages from being added
- Show 10 latest posts only from users with contributors role
- Trying to exclude custom posts based on date, while sorting by custom field
- WordPress, custom post type and posts query help!
- How Can I Always Display A Particular Post First Using WP_Query?
- Deleting post tags removes categories
- How do I keep raw HTML in my RSS feed and not lose my paragraph breaks?
- How to Rearrange WordPress Tags list on frontend using Shortcode with specific order?
- Return records between two meta datetimes saved as strings
- WordPress Query – Display 5 posts (same post type), each from a given tag
- Can I show category name in url for only one of my categories?
- How to add first 3-4 post tags on WordPress Post Title
- What parameters do I need to pass to get_tags to get ALL tags for the site, when used in a post
- Merge get_comments & get_posts into a single query
- Is there a way to categorize a list posts all at once?
- How to optimize posts query in wordpress
- How to get tags when using publish_post
- Check if almost 10 year old – working code is up to date
- Query to fetch custom taxonomy along with post title
- How to fetch courses in all languages in WordPress?
- Query custom post type custom meta key
- Css and function issue on author archive page
- Ignore posts content in the posts queries for internal linking
- Tag for custom post type
- How to search through “post title” and “tags” using WP_Query?
- WordPress get tags in “publish_post” hook
- Need to display a Jan 1st post as the site’s front page on Jan 1st, and Jan 2nd post as front page on Jan 2nd etc
- Remove status ‘archived’ from the default post and page view
- Top tags with minimum number of posts
- How to count posts in tags within time limit
- Why do I have categories with duplicate slugs?
- Exclude posts in home slider from sections
- I have two post types in the same query, how can I use CSS to select only one post type?
- Display all tags even if they are not assigned to a post
- Sync All Post Type Tag
- getting custom post by tag
- Replace Tag Keyword With Link Within Post Content
- Excluding tag Link from html tags in Post content
- I really need help… I am looking for a solution about 28hours
- show only one category and filter by tag
- filter posts based on menu_order
- Bulk Post update_post_meta
- Count posts for pagination
- Show 5 posts and than 3 posts offset with pagination
- AJAX load more posts not using correct category and repeating the same few posts
- I need some explanation on global $post [duplicate]
- How to delete all posts with dead image urls?
- Can I Paginate Post after every 25 tag?
- Numbering author posts in posts query
- How to run select query of post with category and tags?
- Querying posts from current category, using a variable as array argument
- Show all posts from the tags without having to set all of them
- Find post tags words in post content and link them to tag URLs
- Query posts from newest category
- Set multi posts random categories and tags
- Sort Events by Venue Title – Sort Post set by related post ids
- wp query custom orderby not custom field
- Query post for today, if no post get the previous one
- Custom Select Query pagination not working properly
- Query post by meta key of another table
- Sort / Filter Queries
- Hide Certain Tags on Single Post Page
- Query post category & remove any post id
- Display only current page -> posts tags in page
- Display the latest post from some selected authors
- Posts tagged with a-new-tag does not appear
- Advanced Post Display/Pagination/Ordering
- Ordering posts alphabetically by meta keys and title
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Grab next post title in archive page
- Removing a post from the results of a WP Query
- Continuous listing from a custom field
- Back up post tags
- Add tags to post before it’s created
- Displaying Results From Custom Taxonomy Query
- Sort post by category using HTML Select tag
- How to store post rating system data post independent?
- Tags not appearing in “Add New Post” Page
- Get first comment link on the post itself
- WP_Query retrieve custom posts but not the post showing
- Output posts with same name as tags?
- Special Query: Title, Terms, Content – %LIKE%
- How can I count articles retrieved by tags
- Should new posts already have tags?
- Creating pages and getting their values from the database table
- Make division in post_query?
- How to limit post query to only return a total count of items with certain post statuses?
- Display the popular tags by default in the backend post edit page (without having to click on the link that displays them) [closed]
- retrieve post slug by post_tags taxonomy
- Related posts by searching post tags of single post as terms
- Display one post randomly from category on home page
- How to remove a specific script from bulk wordpress posts and images description?
- How to set value in Query Loop?
- Wp_query WooCommerce products
- Tag page that displays specific posts
- The page that displays Posts on homepage
- WordPress More tag doesn’t work on Single post