This is typical issue. While wp_insert_post()
won’t check for user capabilities to insert post, the tax_input
part actually will check if user has permission to manipulate those specific taxonomies.
If you don’t have user logged in state replicated in your shell context then it will fail accordingly.
The solution is to insert post first, then assign terms via separate function calls which won’t check capabilities (yeah, it’s not consistent).
Related Posts:
- wp_insert_post not updating custom taxonomy selected if logged in as a subscriber
- Custom Taxonomy isn’t working from frontend post submitting
- WordPress implode & wp_insert_post question
- wp_insert_post not adding taxonomy (using wp_set_object_terms)
- Update fields with post object and custom tax with wp_insert_post
- How to prevent new terms being added to a custom taxonomy?
- How to add images to taxonomies?
- Read-only taxonomy (user can assign term but can’t create or edit existing terms)
- Can you add the visual editor to the description field for custom taxonomies?
- Adding Category/Tag/Taxonomy Support to Images/Media
- Include and Exclude Taxonomies From Archives & Feeds Using ‘pre_get_posts’
- Taxonomy menu with post count and multiple parents
- Sort Custom Post Type Archive by Taxonomy Term [duplicate]
- Large taxonomy (2000+ terms), causing WordPress to hang
- Is it possible to have a taxonomy archive that lists taxonomy terms?
- Check if current term is a child of another term
- pre_get_posts OR relation between taxonomy and author
- Non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue
- Dynamic page slug for Custom Taxonomies?
- How to pass posts_per_page and paged params query vars to custom taxonomy archive urls?
- show term description instead of list terms of custom taxonomy
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Exclude Custom Taxonomies
- How to get the top most term (top ancestor) of a custom taxonomy child term?
- Edit post meta with checkboxes on front end
- Set download limit and expiry for WooCommerce downloadable products in specific categories
- Search by type posts and taxonomy
- get_the_terms() to show all custom taxonomies
- Get Taxonmy Term ID For Current Post
- Can I limit term selection to one plus parent?
- Insert form checkbox at bottom of taxonomy edit term page
- Taxonomy with_front causes all
- Why is my taxonomy template not shown?
- cannot get multiple loops using tax_query
- Taxonomy archive showing no results
- How to add a Rewrite Rule / Category Structure
- Hide posts having children terms when display posts by category in edit.php
- Get posts by term slug only
- Changing taxonomy term by slug (wp_update_term)
- How to have two different versions of a tag/category/taxonomy archive page?
- Custom Taxonomy Term Caching?
- Controlling Taxonomy Category listings to hide and unhide specifics
- How do I create a custom archive page depending on the custom taxonomy type?
- How to Rewrite Taxonomy URL to Include the Post Type as the Second Segment of the URL?
- Add Custom Taxonomy for Blog Meta Info
- Include parent and child in category url
- woocommerce custom product category template
- Custom taxonomy multiples
- Is there a template file to list all terms of a given custom taxonomy?
- Assign terms to new capability for all taxonomies
- List of users inside custom taxonomy
- Rewrite Rules returning wrong data
- Output unique taxonomy terms of posts inside a loop
- how does the wordpress rest API work
- Taxonomy terms can still be added when only assign_terms capability has been granted
- Use an HTML Element To Filter Taxonomies In WP Search
- tax_query not working
- Weekdays as terms – How to order taxonomy terms by ID in admin panel?
- How to display ACF taxonomy checkbox links on WooCommerce product category archive
- wp_query not resetting, last post hanging
- How to find taxonomy parent id from child taxonomy page?
- custom taxonomy not showing in Gutenberg
- Can I add other Custom Taxonomy to my syntax (functions.php)
- How to remove the search field in custom taxonomy ui?
- How to add hierarchical taxonomy with parent child relation to URL?
- Display children category images
- How to show post for a particular term of custom taxonomy?
- Is there a way to change select-list for new custom taxonomy?
- How to get the term description in a taxonomy term archive query?
- How to define %category% for custom taxonomies?
- How to list terms by first letter, as in A’s then B’s etc
- Taxonomy hide not working
- Create new Taxonomy, add extra fields, register terms AND extra fields values?
- See double taxonomy inputs in WP editor
- How to change custom categories term links?
- Body class to each level of a hierarchical custom taxonomy
- Restructuring permalink with more than one taxonomies
- How to limit custom post category
- ajax drop down change second drop down data
- Redirect or Prevent Viewing of Custom Taxonomy’s Archives?
- Display taxonomy term slugs
- Automatically Populate Post Taxonomy Data Based on Post Author Meta Data?
- Get Posts by tag from a custom taxonomy
- Tax query array terms display out of order
- How to change taxonomy slug?
- Taxonomy to WordPress Permalinks of custom post type
- Advanced AND tax_query in sidebar with 2 taxonomies
- Function code problem
- Permalinks not working on MU network with domain mapping
- Create WordPress taxonomies based on theme settings
- Alternative for is_taxonomy() to workaround theme’s default sidebar
- Get custom taxonomy term url on archive page
- I’ve got a function that auto creates taxonomy terms – Can it auto delete them as well?
- Get custom taxonomy value of post and output posts in same taxonomy
- Head Code for Custom Taxonomy
- Adding new terms to custom taxonomy
- List posts grouped by children of a custom taxonomy
- Add Gutenberg editor to edit taxonomy (category) page
- post_type_link not working for posts without terms
- Why my archive title isn’t showing?