• Resolved sudhirhm08

    (@sudhirhm08)


    Hi folks,

    I am creating a python script which will upload all the posts and images using WP CLI. However I want to delete the attachment which is related to a post ID.

    Using WP CLI how do I get the Feature image post ID using the Post ID.

    2. How do I delete the unwanted tags in wordpress DB?

    Thanks,
    Sudhir

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey Sudhir,

    Assuming that 1000 is the post ID, get the ID of the featured image:

    wp post meta get 1000 _thumbnail_id

    To delete a tag, assuming foobar, first get its ID:

    wp term list post_tag --name=foobar --fields=term_id --format=csv

    Assuming the term Id is 123, delete it with:

    wp term delete post_tag 123

    Hope this helps!

    Thread Starter sudhirhm08

    (@sudhirhm08)

    Thank you very much George. This really helps.

    -Sudhir

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

The topic ‘few questions on wp cli’ is closed to new replies.