This should work
function exclude_posts( $query ) {
if ( $query->is_home() ) {
$query->set( 'tag__not_in', array( 13 ) );
}
}
add_action( 'pre_get_posts', 'exclude_posts' );
tag
and tag_id
are not set up like cat
to accept negative numbers (ID numbers) for exclusion (conclusion based on experiments, not digging into the code (some other time, perhaps!)). Also, all of the examples in the Codex use is_home()
, is_admin()
, etc., but apparently is_home
does work – without the ()
.
Related Posts:
- how can I use WP_Query to exclude a specific tag.?
- Add exception for specific tag
- Exclude a specific tag from the get_the_tags list
- How to exclude a specific tag from the list of tags for the current post?
- How to list all tags except the current tag in tag.php
- Hide/exclude certain tags under single post
- Exclude Tags by Array
- Show all tags but exclude a certain tag
- Why is wp_kses not keeping style attributes as expected?
- Order tags, but not alphabetically
- How to Get Next or Previous Post in a Specific Tag?
- What is the difference between terms and tags?
- not functioning
- How to use the Tag description as the title attribute?
- Best way to show map of tagged posts?
- Remove a particular tag name from the tagcloud
- How to remove Tags: text from the_tags?
- What are allowedposttags and allowedtags?
- When switching from html to visual editor the tag gets erased
- Showing all tags in admin -> edit post
- Redirect Tag to Post with the same name
- Exclude Custom Post Type & Pages From Auto-Tag Function
- How can I extend Quick Edit option with 2 more fields
- How to separate the tags?
- alt attributes not showing on pages
- Add # before each tag
- display tag slug as class per link in tag cloud
- How to add class on term link?
- Why ‘C++’ tag is converted to ‘C# ‘?
- How to show tags in posts, orderby count(most used) not alphabetically?
- How to use meta data for each tag cloud a
- Display all posts of current viewing tag
- Limit tag cloud terms by date
- Is is possible to rebuild wp_term_relationships table?
- Sort list of WordPress Page under tag when is_tag() called
- URL scheme to retrieve tag archive by ID
- How to get all tags collections in woocommerce?
- In need of array of post tags
- Get the tags as an array, convert the tag into a string, and then replace spaces with dash
- Setting a value on existing tag metadata field when that tag was just created by a user
- Query all posts which do not have tags assigned to them
- How to list custom tags too, to wp-list-table table?
- how to filter each tag item?
- Display posts and thumbnails with certain tags
- Creating custom tags
- What is the best way to create a menu item that links to all posts with a certain tag?
- Using HTML 5 Details/Summary Tag
- Get all terms if product of that term contains a specific category
- How can the user place a custom text string as a placeholder for a plugin
- Show post tags on attachment page?
- using get_the_category to get all post categories except one
- What hooks are needed to bind a tag to a reusable block?
- Adding post tags without capability edit_posts
- Track tags in Google Analytics? [closed]
- tags not showing on custom post type single page
- merging terms programmatically while maintaining the count
- How to get the first tag of a post as a hyperlink?
- Echo tag name if post has one of the tags
- Display post if a specific tag is present
- Do we have In_category like function for tags?
- Can’t Find a “Most Popular Tags” Hack Anywhere [closed]
- How to display related posts from this code?
- How to add a class to anchor tags using the get_the_tag_list(); function? [duplicate]
- how do i put “h1” tag in css as class and call it anywhere in the website files [closed]
- category specific most used tags query
- Sort tags by first letter or included number
- Removing a taxonomy term
- Is there a way to retire old tags?
- How to change tag Title to its name?
- Setup proper 301 redirect for deleted tags
- Bumping a (tagged) post to the top of archives
- how to add # before tags?
- Tags page not for post
- How can I combine WordPress default Tags and bbPress tags into one archive page?
- Remove link and Add class to get_the_tag_list()
- How to get tags from different blog?
- Unable to Change Title in WordPress Dashboard
- How can I show a tag description, using ‘slug’ rather than ‘id’
- Is it possible to have a Faceted Navigation/Filters on a Product Tag page?
- How to list tags
- If tag x then show y + tag name(s)
- Exclude Posts from a Widget
- get_the_tags function not retrieve all tags for specific category
- Conditional inside search result excerpt
- Show all tags NOT applied to post
- Hide Tag Title When No Tags
- Is There A Way To Add Weight Or Order To Tags?
- Feedburner closing error
- Change CSS on tag in tagcloud, if ther current post is tagged with the tag
- Tag selection while adding new post
- where to find on backend to amend and edit title tage for each page on website?
- Create a separate widget for both Tags and TagsCloud?
- How to include post count in this “get_tags” snippet
- How to make a Post Tag primary?
- How can I edit the slugs of tags?
- Listing tags with custom html output
- Exclude specific tag or tags from related posts?
- How to export tag counts to excel?
- Datetime on time tag wordpress puts it outside the tag
- WordPress Title Tag Not Changing