• 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_type
    unknown –parameter name
    unknown –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 https://www.DeepL.com/Translator (free version)

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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

    -post-type

    and sometimes

    --post-type

    is written. The latter would be correct. However, the value is then also expected without inverted commas. So:

    --post_type=post

    Example: wp post list --post_type=post

    See: https://developer.www.ads-software.com/cli/commands/post/list/

    Thread Starter Mariano Cucinotta

    (@superdiogene)

    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?

    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 post list --post_type=post --name=hello-world --format=ids
    Thread Starter Mariano Cucinotta

    (@superdiogene)

    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 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

    The subquery

    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

    (@superdiogene)

    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.