• Resolved braehler

    (@braehler)


    Hey there,

    I′m currently deleting old non featured jobs from our system. I wrote a function for that. So now, I got about 20.000 jobs in the trash. Is there a way to delete them via WP CLI? Because deleting them from the backend site would take ages ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • wp post delete $(wp post list --post_status=trash --format=ids)

    Thread Starter braehler

    (@braehler)

    @e2robert

    thanks but I had to change the code a little bit, this one here does the job

    wp post delete $(wp post list --post_type=job_listing --post_status=trash --format=ids) --force

    It returns an error to me with “usage: wp post delete … [–force] [–defer-term-counting]”

    Thread Starter braehler

    (@braehler)

    @its7376

    I do not use the option of defer-term-counting in my command, so iI cant tell where the error comes from, but it seems you are using “-” instead of “–“, And I would suggest to make sure you are running the latest version of wpcli. And maybe you post the error here

    • This reply was modified 8 months, 1 week ago by braehler.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Empty Trash via WPCLI’ is closed to new replies.