Your issue is last argument in wp_set_object_terms()
call. You are setting $append
to true
, so it essentially checks if input is already present and does nothing else.
You want it set to false
(which is also default) so that terms are forced to be same as input and difference (what you removed) is deleted from post.
Related Posts:
- What is the difference between terms and tags?
- Display tags belonging to a specific post type only
- Creating a unique, linked list of tags from a specific category?
- How to add class on term link?
- get_terms with more than x post count
- Strict tag list – user should choose only existing tags for posts
- Limit tag cloud terms by date
- Display custom list of tags in post/page editor with hooks
- how to filter each tag item?
- get_tags() return an empty array after added tags with wp_insert_term()
- merging terms programmatically while maintaining the count
- Add post tag without post id
- Show all videos by tag name
- Sort query_terms_list for post_tags alphabetically
- List latest post for each tag with a category
- Exclude Tags by Array
- How to take list of words and insert them as terms to become tags of a post
- How to include post count in this “get_tags” snippet
- Is There a Difference Between Taxonomies and Categories?
- Why is wp_kses not keeping style attributes as expected?
- Order tags, but not alphabetically
- WordPress: Can I add categories/tags to all sites in my network at once?
- How to Get Next or Previous Post in a Specific Tag?
- How do I display a tag cloud under my post that only shows tags from that post?
- Control term order on a per-post basis
- Display list of most used tags in the last 30 days
- Check if current page has given tag ID
- how do I get the tag name from tag id?
- Do tags have dates?
- Stop wordpress from removing HTML attributes
- Stop WordPress From Removing HTML Comments In Content
- How can I let my audience tag my posts?
- Display tags in list without link
- how can I use WP_Query to exclude a specific tag.?
- How can you tie into the tag metabox?
- show tags of custom post type ONLY
- not functioning
- How to use the Tag description as the title attribute?
- Best way to show map of tagged posts?
- How to display the_tags() as plain text
- Remove a particular tag name from the tagcloud
- How do I change the output of get_the_tag_list()?
- Query all posts with specific tag
- How to query with get_posts() for posts with any tag
- How to remove Tags: text from the_tags?
- Change tooltip in tag cloud
- Getting an ordered list of tags – via wp_tag_cloud or not?
- Is it possible to filter get_adjacent_post() with tags?
- array_pop() expects array, boolean given for $event_type_term ->slug
- Apply class to the a tag link generated in post tag links
- What are allowedposttags and allowedtags?
- Display tags for current post in sidebar
- How to allow user to perform search by more than one tag
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- Get_term_by only returns one item from array
- When switching from html to visual editor the tag gets erased
- How important are WordPress tags for SEO purposes?
- get_post_ancestors returns empty
- Combining tags from post types
- Non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue
- Allow visitors to search by multiple tags (specific IDs)
- List ‘n’ number of posts from a Tag, each with a different class or ID
- Showing all tags in admin -> edit post
- Redirect Tag to Post with the same name
- how to limit and display tag?
- Add exception for specific tag
- WP_insert_term how to insert multiple values as taxonomny term?
- Creating a Lightweight Media Tags Plugin with a Custom Taxonomy
- Link from tags to tag pages displaying all posts with that tag
- Displaying the most recently used tags
- Limit tag word count
- When are tags counted? Can it be trigered manually?
- How can I extend Quick Edit option with 2 more fields
- Can’t Get ‘tag’ Page To Display only Tagged Posts
- How to separate the tags?
- alt attributes not showing on pages
- Massive Tags Remove Using MySQL
- Add # before each tag
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- Quicktags on all textarea.. Not working on plugin?
- term/tag not being saved for custom post type
- display tag slug as class per link in tag cloud
- how to change # of tag posts on /tag page?
- require one tag for each post
- How can I remove certain HTML tags from the RSS feed?
- Stop WordPress removing tags when switching from HTML to Visual (TinyMCE)
- Get Term names from WP Term Object
- WP API Get post with tag names instead of tag ID’s
- Link directly to the first post in an archive
- Set homepage to only display posts from one tag
- Tags as a dropdown with set tags
- Why ‘C++’ tag is converted to ‘C# ‘?
- Change the color of post title on specific tags
- How to show tags in posts, orderby count(most used) not alphabetically?
- Individual css class for each tag in wp_tag_cloud
- How to use meta data for each tag cloud a
- Special characters in tag get removed for comparison on save
- How to remove/hide the predictive autocomplete popup when I type in the tag/term metabox
- Exclude a specific tag from the get_the_tags list
- Display all posts of current viewing tag