This is what I would consider the correct solution, and is the solution alluded to by Milo’s comment (if I am not mistaken).
function alter_ppp_for_tags_wpse_88337($qry) {
if ( is_tag() && $qry->is_main_query() ) {
$qry->set('posts_per_page','-1');
}
}
add_action('pre_get_posts','alter_ppp_for_tags_wpse_88337');
Using query_posts
will cause two requests to the database– the main query, and the query triggered by the use of query_posts
. By using a filter on pre_get_posts
you alter the main query before posts are fetched and thus only hit the database once.
Reference:
Related Posts:
- Is There a Difference Between Taxonomies and Categories?
- What is the difference between a “tag” and a “category”?
- Can’t custom taxonomies have same terms (slugs) as categories?
- How do the ‘tag’ and ‘category’ (default) taxonomies do ‘save_post’ action?
- Control term order on a per-post basis
- get all tags from category
- 404 Error On Category and Tags Pages
- Checklist of selected categories
- How to tax query X number of posts related by tag first, then by category if not enough in tag-related
- Sort posts by tags in category pages
- How to search for categories and/or tags?
- How to get the url to tag & category base set by the user?
- Filter categories using tags
- Sticky posts on home page, search, tag and archives without plugin
- Category and tag with same name
- 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?
- Automated adding of one tag to all the posts in a category
- Exclude most recent posts from specific category in wp_query()
- When using get_categories or similar, is it possible to filter results that contain certain Tags as well?
- Root level category, tag, author and archive pages to work
- Deleting All tags except categories Wp database
- Search by word, category, tag, author
- Remove Categories and Tags from Admin Dashboard
- How to filter archives both by category and tag?
- Get tags specific category
- Category archive page – loop through posts of certain tag (with pagination) – pre_get_posts
- Category vs Tag vs Table
- Help with multiple dropdown tags search
- Custom WP_Query for current category (in category.php)?
- Hide tag and category boxes from the post editor
- Retrieve all posts within tag OR category?
- How to find the number of Tags a post has?
- How to not treat categories as tags in feeds
- Categories: A Greenhorn Question on Strategy (Not Code)
- How to customize tag and category post listings to show introductory content?
- Are Category or Tag Archive Pages Possible?
- Making a tourism information website [closed]
- Random post + categories + tags
- Search Posts / Pages with multiple options?
- How get permalink for the current category or tag?
- Display tags from specific category in select fields
- Offline WordPress Application
- Find out which user created a category or tag?
- RSS/XML of all Categories and/or Tags
- How to make 2 tag feeds show up on 1 page?
- Different templates for different category tags
- 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
- Get link which associated with a specific category and tag
- How to get related tags based on a category?
- Needing a snippet for listing category specific tags
- How to list categories within tags?
- Use Tag input metabox style for Categories
- menu using category and tags
- limit a list of tags to one category [closed]
- Is there a reason I cannot get the current category in a loop?
- How to Remove a Title from All Category and Tags Page?
- How can I display tags as categories?
- How to get an array with all categories and corresponding names?
- Display all product tags associated with a specific product category
- How replace individual elements in the RSS feed with a single string
- Tags Instead of Category
- Use blog as base for tags and categories
- How to store category and tags separatly on wordpress?
- Filter categories/tags to display in multiple metaboxes for selection in back-end
- post_class remove tag- or category- from slug
- Editing Loop So It Targets Specific Tags?
- How can I include custom category and tag base in template files?
- Pretty URLs with Categories and Tags
- Autolinking keywords in text with tags
- Maintaining a separate posts page for certain categories and don’t show those on home page
- Are tags different than categories?
- What is the best way to add an advanced / intermediate / beginner tag to a post
- Show Posts via cat+cat in URL that are in both Categories doesn’t work
- Display all categories but only if they have posts in them that have a specific tag assigned
- Help to display the current categories and tags of a post
- How to add tags under categories
- Add Post Categories in Post Tags Field Programmatically
- Hide specific category tag on single post page
- Filtering posts in category by tag URL
- echo $category[0]-> cat_name; shows only one category name
- How to show entries related to main category
- Automatically create tags and merge with categories
- How to assign Categories and tags inside the TinyMCE Editor for each Image?
- Re-coding category-template.php to go to custom URL
- Search by tag, category and author without plugin
- Limit Category/Tag Dropdown To blog_id in Multisite Install With Global Categories/Tags
- Tag Menu items based on their categories
- How to add an “All” category to the tag cloud?
- Hide category name using mod_rewrite
- How to exclude category and post_tag taxonomy while displaying custom taxonomy?
- 404 error when i try to search by category or by tag
- Unable to get all tags from specific categories
- Display related posts with same category or same tag return blank
- htaccess redirect for all categories converted to tags now showing 404
- altering theme – content generated by PAGES not PORTFOLIO
- Search tag within category
- List products from current category
- In my wordpress admin panel Suddenly The Category, tag and featured Image Option are not showing