Title: WPCLI &#8211; unknown &#8211;post_type parameter
Last modified: February 16, 2024

---

# WPCLI – unknown –post_type parameter

 *  [Mariano Cucinotta](https://wordpress.org/support/users/superdiogene/)
 * (@superdiogene)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wpcli-unknown-post_type-parameter/)
 * Hi all, I am trying to execute with WPCLI the following code:
 * wp post delete $(wp post list –post_type=’post’ –name=hello-world –format=ids)–
   force && wp post delete $(wp post list –post_type=’page’ –name=sample-page — 
   format=ids) –force && wp post create – -post_type=page –post_status=publish —
   post_title=”Home” && wp post create –post_type=page –post_status=publish — post_title
   =”Blog” && wp term update category 1 –name=Various — slug=various && wp option
   update timezone_string “Europe/Rome” && wp language core install it_EN && wp 
   site switch-language it_EN && wp option update show_on_front page && wp option
   update page_on_front $ (wp post list – -post_type=’page’ –name=home –format=ids)&&
   wp option update page_for_posts $(wp post list –post_type=’page’ –name=blog –
   format=ids) && wp option update rss_use_excerpt 1 && wp option update blog_public
   0
 * but unfortunately I get the following errors:
   parameter unknown –post_typeunknown–
   parameter nameunknown –parameter format
 * I point out that:
   1) I am using windows 10;2) I am using the code locally with
   the help of: LOCAL
 * Translated with [http://www.DeepL.com/Translator](http://www.DeepL.com/Translator)(
   free version)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wpcli-unknown-post_type-parameter/#post-17431858)
 * Try breaking the command down into its individual parts. As “post_type” occurs
   several times, it is unclear which subcommand the error message refers to. I 
   notice that sometimes
 *     ```wp-block-code
       -post-type
       ```
   
 * and sometimes
 *     ```wp-block-code
       --post-type
       ```
   
 * is written. The latter would be correct. However, the value is then also expected
   without inverted commas. So:
 *     ```wp-block-code
       --post_type=post
       ```
   
 * Example: `wp post list --post_type=post`
 * See: [https://developer.wordpress.org/cli/commands/post/list/](https://developer.wordpress.org/cli/commands/post/list/)
 *  Thread Starter [Mariano Cucinotta](https://wordpress.org/support/users/superdiogene/)
 * (@superdiogene)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wpcli-unknown-post_type-parameter/#post-17432505)
 * Thank you threadi for your response.
   I have tried splitting the commands and 
   running them individually to see where the error occurs, but even individually
   and following your directions I always get error. This is the command line:
 * wp post delete $(wp post list –post_type=post –name=hello-world –format=ids) –
   force
 * Could you please tell me what is wrong?
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wpcli-unknown-post_type-parameter/#post-17432845)
 * Unfortunately, if you do not write the command as a code block here in the forum,
   it will be received incorrectly. A different hyphen is then used than the one
   you probably used.
 * For me it works with the following command:
 *     ```wp-block-code
       wp post list --post_type=post --name=hello-world --format=ids
       ```
   
 *  Thread Starter [Mariano Cucinotta](https://wordpress.org/support/users/superdiogene/)
 * (@superdiogene)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wpcli-unknown-post_type-parameter/#post-17432869)
 * the code doesn’t give any error, but I don’t understand what it does it doesn’t
   create hello world and it doesn’t delete hello world.
 * I would like to figure out how to delete it. In this example:
 *     ```wp-block-code
       wp post delete $(wp post list --post_type='post' --name=hello-world --format=ids) --force
       ```
   
 * the post should delete itself, as I followed in a totorial on the web. Whoever
   wrote it reported to me that the command works correctly on Apple platform me
   it failed on Windows platform and he doesn’t understand why either
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wpcli-unknown-post_type-parameter/#post-17432908)
 * The subquery
 *     ```wp-block-code
       wp post list --post_type='post' --name=hello-world --format=ids
       ```
   
 * works correctly for me. It returns a 1 for the post ID that is queried here.
 * This number is then passed to the surrounding query, which then also deletes 
   the data record. Works for me (under Linux) without any problems and without 
   an error message.
 * My guess in your case is still that you are working with the wrong “-“.
 *  Thread Starter [Mariano Cucinotta](https://wordpress.org/support/users/superdiogene/)
 * (@superdiogene)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wpcli-unknown-post_type-parameter/#post-17432944)
 * It could depend on the version that is installed in Local WP-CLI: WP-CLI 2.9.0
   while I think the latest is: wp-cli:2.10.2 could depend on that. I need to document
   whether or not I can update the version of Local

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘WPCLI – unknown –post_type parameter’ is closed to new replies.

## Tags

 * [wpcli](https://wordpress.org/support/topic-tag/wpcli/)

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 6 replies
 * 2 participants
 * Last reply from: [Mariano Cucinotta](https://wordpress.org/support/users/superdiogene/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/wpcli-unknown-post_type-parameter/#post-17432944)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
