It’s because within wp_insert_post
current user capabilities are checked before adding the terms:
if ( current_user_can($taxonomy_obj->cap->assign_terms) )
wp_set_post_terms( $post_ID, $tags, $taxonomy );
to get around this, use wp_set_object_terms
instead after wp_insert_post
to add the terms:
$new_post = array(
'post_title' => $postTitle,
'post_content' => $post,
'post_status' => 'publish',
'post_date' => date('Y-m-d H:i:s'),
'post_author' => $user_ID,
'post_type' => 'publications'
);
$new_id = wp_insert_post( $new_post );
wp_set_object_terms( $new_id, $term_id, 'publicationstype' );
Related Posts:
- WordPress implode & wp_insert_post question
- Using wp_query is it possible to orderby taxonomy?
- How to add images to taxonomies?
- Can you add the visual editor to the description field for custom taxonomies?
- Check if a post has any term in this custom taxonomy?
- custom post type taxonomy “tag” archive : no post found
- Get taxonomy names by post id
- Modify Term Update Redirection
- Check if current term is a child of another term
- Custom hierarchal taxonomy loses interface hierarchy when selecting parent & children
- get_terms() doesn’t return empty terms even though hide_empty is false
- Formating the_terms() function output
- Archive template for taxonomy terms
- Custom taxonomy on users with UI
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Taxonomy Relationships
- How to get the top most term (top ancestor) of a custom taxonomy child term?
- Combine multiple custom user taxonomy in single url
- Add custom taxonomy to default category taxonomy?
- Taxonomy , subtaxonomy,child taxonomy of a product woocommerce
- Get terms ordered by post date
- wp_insert_post via shell category not being inserted
- How to display custom taxonomy in multiple columns?
- Removing the “Popular Terms” area from the Taxonomy Edit Screen in the Admin Area
- Sorting taxonomy columns by meta value numeric
- Programatically added attribute, set to ‘show on product page’ automatically. Woocommerce [closed]
- ACF vs Taxonomies
- Reverse traversing taxonomy based on term_id
- How to filter terms from a custom taxonomy by a usermeta value on all screens and templates
- Get Current Custom Taxonomy ID by Post ID
- Changing stylesheet depending on custom taxonomy terms
- Taxonomy with_front causes all
- Taxonomy archive showing no results
- I used the Tax-meta-class by bainternet but i still can’t get it to display any of the results.
- Autogenerate Front End Form Field With jQuery
- Changing taxonomy term by slug (wp_update_term)
- Rewrite Rule Working for all but one of the taxonomies created
- Taxonomies on custom taxonomies
- How to join result of different taxonomies?
- How to add Post Format Taxonomy Archive page in the menu?
- How to Rewrite Taxonomy URL to Include the Post Type as the Second Segment of the URL?
- How to get all taxonomies which can be added in menu?
- WordPress Tag or Custom Taxonomy Return All Posts if has that Word in Post Title
- woocommerce custom product category template
- Replace taxonomy permalinks
- Custom Taxonomy Term Archive Page Template that Filters 2 or more Taxonomies
- Multi-select field for Taxonomy can’t save the value
- Create custom taxonomy and Display in metabox dropdown
- How to create a custom taxonomy using a shortcode?
- Override Taxonomy Template
- Get the taxonomy of the post
- Get object for a few selected taxonomies
- Trying to add taxonomy to get_categories() but it’s not working. How to fix this?
- Filter through custom taxonomy with an array of taxonomy IDs
- Dropdown taxonomy lists in admin menu
- Taxonomy archive template that shows posts from more than one taxonomy
- Taxonomy Overview Page?
- Order taxonomy terms wordpress
- Unable to get the Parent Custom Taxonomy Terms
- How to get the term description in a taxonomy term archive query?
- How to define %category% for custom taxonomies?
- Unsetting post_tag taxonomy breaks term description for other taxonomies
- Taxonomies on Pages with Custom Formatting
- Why do my quick edits for custom taxonomies not show on the post frontend?
- Prioritise Pages over Taxonomy Term Root Archive, but not Taxonomy Term Child Archives
- Tracking the name of a custom taxonomy
- new custom filed not showing in taxonomy
- How do I get the correct URL?
- Custom Taxonomies Archive Page 404
- How to replace custom post type with custom taxonmy in permalinks
- Cloning product not copying custom taxonomies
- How To Create Dynamic Permalink To Custom Taxonomy List of Current Posts?
- Dropdown (with onChange) with custom taxonomies
- Unregistered taxonomy apears still as emtpy filter list
- ACF Custom field not showing in Timber Taxonomy page
- How to get a terms and posts associated with another term?
- Displaying subcategories and then posts in taxonomy template
- How to use two same taxonomy in same post differently?
- Sort Taxonomy List by Custom Values
- Display taxonomy term slugs
- Can I use multi (sub) levels of relation (AND | OR) on custom query?
- How to display custom taxonomy
- How to use tax_query other than by slug or id or solve custom taxonomy tags conflicts with pre-existing tags?
- Taxonomy term breadcrumb; how?
- add custom fields in custom taxonomy meta box in wordpress-3.5.2
- How to permanently delete a taxonomy
- Advanced AND tax_query in sidebar with 2 taxonomies
- Alternative for is_taxonomy() to workaround theme’s default sidebar
- What is the current page’s Taxonomy?
- Get custom taxonomy term url on archive page
- Custom Taxonomy Template Variables Available?
- Display woocommerce product_cat child terms with thumbnails
- Adding new terms to custom taxonomy
- Group custom taxonomies based on tags contained in their posts
- Prevent random entries in hierarchical false taxonomies
- Exporting CSV of users with custom user taxonomies out of WordPress
- Taxonomies starting with a hyphen (minus) to assign B.C. dates to a post
- Querying posts globally based on custom taxonomy with its own taxonomymeta table
- How to delete unused terms?
- Child terms with improper parent in the url should redirect to 404