Here is what I came up with, seems to work:
add_filter( 'pre_post_tags_input', 'no_tags_input_create' );
add_filter( 'pre_post_tax_input', 'no_tax_input_create' );
function no_tags_input_create($tags_input) {
$output = array();
foreach( $tags_input as $tag )
if( term_exists( $tag, 'post_tag') )
$output[] = $tag;
return $output;
}
function no_tax_input_create($tax_input) {
if( !isset($tax_input['post_tag']) )
return $tax_input;
$output = array();
$tags = explode(',', $tax_input['post_tag']);
foreach( $tags as $tag )
if( term_exists( $tag, 'post_tag') )
$output[] = $tag;
$tax_input['post_tag'] = implode(',',$output);
return $tax_input;
}
This is for tags, you can easily extend second function to handle custom taxonomies.
Related Posts:
- How do I display a tag cloud with both post tags AND a custom taxonomy?
- Can I turn off write-in tags/taxonomies?
- How to remove the tag cloud from custom taxonomy admin page?
- Custom columns on edit-tags.php main page
- custom post type taxonomy “tag” archive : no post found
- Exclude Specific Term from Search
- get_term_by not working when in functions.php
- Is it possible to use one slug for Multiple Taxonomies?
- Widget to display custom taxonomy tag cloud
- Formating the_terms() function output
- Find callback function for custom taxonomy metabox
- Scheduling posts to update once per day with wp_cron
- Post tags saving as both tag name & tag ID on post update when tags are displayed as checkboxes
- Non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue
- How to display and use all existing tags at my write-post-at-frontend-panel?
- Possible to register multiple custom taxonomies in one function?
- how to get title to custom tags page
- How do I add customize_register action AFTER adding a custom taxonomy
- WordPress renames slug of tags used in multiple taxonomies?
- Allow only 1 instance of each term in each custom taxonomy
- How do I make a custom taxomony appear like tags?
- Adding ‘active’ class to custom taxonomies using walker in functions.php
- Make tag cloud links consistent
- Check if term is in a taxonomy?
- Hook to change Custom Tag Taxonomy Links?
- How to adjust code to refresh a dropdown box with tags that are active on filtered category listing
- Metabox to list/store a certain type of post tag
- Sorting Tags by Slug Value
- Extend & Search Native WordPress Image Galleries With Tags and Taxonomies?
- How to filter a post in the Tag Cloud widget, using tags of a media library image attached to the post?
- Replace taxonomy permalinks
- Front-End Custom Taxonomy Tag Select
- get_terms not returning any custom taxonomies
- Create custom taxonomy and Display in metabox dropdown
- Problem with removing post tags programmatically
- Display formatted list of taxonomy terms with last seperator different
- How to get custom category’s link?
- saving meta/custom field to tag
- Changing input type from text to multi select dropdown – skill taxonomy
- How to call a custom taxonomy term name inside a function?
- Displaying user selected custom tags/taxonomies on the front-end
- Update Post Taxonomy Automatically Based On Date
- Featured Images for Tags?
- Taxonomy archive template not working
- Running a function only once when a taxonomy term is changed
- Displaying the post count of all custom taxonomy terms in a list format
- Automatically tag posts based on user-defined words [closed]
- making an index from custom taxonomies and tags of posts (not hierarchical taxonomy)
- Set two terms for a post when they differ only by an accent
- CPT tags not showing when editing post
- Get tags name under custom taxonomy in wordpress
- Filter Tags for current users
- Limit Tag Links in Post Content
- Change the Page Title of the Archive Page for Portfolio Tags
- How to add meta fields to custom taxonomy add/edit page?
- Using wp_tag_cloud with only current post tag with special class
- WordPress shortcode Issue!
- Automatically Populate Post Taxonomy Data Based on Post Author Meta Data?
- Get Posts by tag from a custom taxonomy
- Display the first tag assigned to a post
- Display custom post taxonomies
- Where to put code to get custom taxonomy term id?
- Function code problem
- How to randomise a custom taxonomy tag cloud
- How do i change the tags and taxonomies
- Any way to make custom taxonomy field searchable?
- How to get tags with custom taxonomy field?
- Primary Taxonomy for Post
- I’ve got a function that auto creates taxonomy terms – Can it auto delete them as well?
- Group custom taxonomies based on tags contained in their posts
- WP REST API no longer supports filter param, so how do I get posts in a custom taxonomy?
- Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
- display posts with same taxonomy term
- Best pratice to make taxonomy terms translatable without changing slugs?
- Get the latest taxonomy/category?
- Custom taxonomies, with custom rewrites/slug, AND loading a taxonomy archive template from a plugin
- Custom Taxonomies but with Icons associated?
- Is it possible to create exclusive custom taxonomy?
- Custom Taxonomy Archive BUG
- how does get_term_by know which term to return when the same term appears twice in a hierarchical taxonomy?
- Get custom taxonomy for visual composer shortcode but not working?
- Multi-select field for Taxonomy can’t save the value
- How to Display a menu only if it has Posts in Custom Menu?
- Displaying posts that belong to a specific author
- Why is flush_rewrite_rules mandatory after registering custom taxonomies?
- Set term on an attachment using wp_set_object_terms and want to display the full term text but it’s showing a slug instead
- how to get term id from current post type instead of name
- Taxonomy term description with style, only if the description exists?
- How to Create Multi selection search Form using Default WordPress Category Terms, and Custom post Types Taxonomies Terms?
- Cloning product not copying custom taxonomies
- Restrict viewing of posts by category, user role
- WP Query : strange behaviour with multiple no-hierarchical tax
- Does a codex exist for creating meta boxes in taxonomy
- Run next query based on first query’s term
- Get the original menu item name string instead of the label
- How to query posts that are not related to any term of a taxonomy?
- add_action with variable as a part of the $tag string
- How to display Custom taxonomy on custom post listing page [duplicate]
- Add text in custom taxonomy
- How do I check if a post has a term with a particular ancestor/parent?