This is probably impossible since WP-CLI pass the arguments directly to wp_insert_posts
. I’m automating this with wp eval
. For example:
wp eval 'wp_set_object_terms(12 , array(1, 2, 3), "course");'
The post id can be obtained when you create the post with --porcelain
:
wp post create ... --porcelain
Or by normal query with post title:
wp eval 'wp_set_object_terms(get_page_by_title("Test Post #1", OBJECT, "lecture")->ID, array(1, 2, 3), "course");'
Related Posts:
- Update post meta does not serialize array
- wp_insert_post($post), add an array of values with update_post_meta
- Multipe array in meta_input
- wp-cli displays php notices when display errors off
- Nice way to print_r arrays
- Why does get_users suddenly return duplicates?
- How to use command ‘wp post create’ in wp-cli properly?
- Generate WP-CLI @alias for each site on multisite
- WordPress: How to use post_class() in an echo
- How do I set and list page_template with wpcli?
- Updating wp_options with an array on save_post results in duplicated entries
- Passing a variable into Contact Form 7 [closed]
- Comma seperated list of ID’s as an array?
- update_post_meta from data in multidimensional array created from a form
- post__in works but also prints the word Array
- Make Selected Mutiselect Items “selected”
- settings api store multiple array
- if is_singular array not working as expected
- How to disable XML-RPC from Linux command-line in a total way?
- How do I update a specific object in an array, in user meta?
- Get posts id in array by meta value and key
- How to save array of datas in option page by setting api?
- Sort a custom post type array numerically
- How to change a post attribute to homepage using WP CLI?
- How to add day number and initial to my post graph?
- How to validate register settings array
- How to check an array of $curauth fields?
- Problem with wp_update_post
- Replace text inside a huge multidimensional array
- Shortest way to install WP-CLI
- How to use IN array properly in WordPress?
- WordPress Plugin Dev: Using array for WP options
- WP Cli will not execute on Windows
- Only a part of array is stored in transient – what could be causing this?
- update_post_meta() with a modified array?
- Error updating WP-CLI
- How to get update_post_meta output to include string length
- Return array keys and values
- How pass a 0 in $atts?
- How to save data of an input field to an array
- Retrieving multiple values to the Post Meta (using an array)
- Echoing a variable inside a function
- Stuck with a Custom Field Check box Array
- Compare with WP Meta Query
- How to Translate a string of an array inside a class?
- How to pass conditional array to wp_localize_script
- How to retrieve text only from a post using WP CLI?
- wp search-replace (not executing)
- Modify foreach loop for social sharing links?
- Combine get_page_by_title to exclude pages from wp_list_pages
- Plugin settings page checkbox not saving – one options array with sub array
- Running custom defined WP-CLI commands without WordPress installation present
- Selecting and outputting results from DB with an array
- Struggling with array and foreach loop
- Customizer Settings in Arrays
- WordPress i18n in Array throws Error
- How to use json_decode a post_meta value? [duplicate]
- How to decipher the following array
- Save meta box values as an array to wp_postmeta
- How to display line breaked meta values in table?
- How can I list all installed plugins/themes/versions from CLI/API?
- Organizing and grouping an array by year
- array_filter warning – wp-includes/post.php line 3148
- wp-cli for Creating page-template
- Hide sidebar if post_type is in array
- Array in meta key?
- Saving array keep adding length of array
- Obtaining values from objects
- How to get a page array and category array going at the same time?
- get_the_terms, whether I should use string or array as the second parameter?
- Obtaining array item from WordPress revisions output
- WP-CLI –meta-input error: Warning: Invalid argument supplied for foreach()
- Matching slug terms from one array to those in array of WP_Term objects to output term names
- Print specific values stored in a post meta array
- Do not replicate items if they exists in a foreach loop
- WP Page Options Array
- Array is not working in Filter?
- How to put an array in wp user query
- Get the values from an array string to work with post__in
- return paginate_comments_links() as array
- Inserting a random number into an array [closed]
- Get array value
- Random element in get_post_meta array
- update_user_meta duplicates entry
- Ways of dealing with nested arrays within option
- Add formatting to Array
- How to randomise my menu items?
- Bulk update published posts date randomly using wp-cli?
- How to get the `comment_post_ID`?
- Using the WP CLI to output the HTML results of calling a post?
- Taxonomy terms not properly displaying as array
- WordPress, result array of ‘post_name’
- Why are array_slice() and array_chunk() not working?
- Retrieve array items without page ID
- How do i fix this “call_user_func_array()” error
- How can I get the content of the current page in my loop while merging post-type
- update_post_meta adding to array instead of replacing value
- bash script wp-cli search-replace 0 replacements, but command-line 3000+
- Add Array record to Meta Post
- How to output get_tags array list to select box