Wp post (WP-CLI)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

wp post : Manage posts, content (pages), WooCommerce products, meta and more.

$ wp help post


  wp post


  Manages posts, content, and meta.


  wp post <command>


  create        Creates a new post.
  delete        Deletes an existing post.
  edit          Launches system editor to edit post content.
  exists        Verifies whether a post exists.
  generate      Generates some posts.
  get           Gets details about a post.
  list          Gets a list of posts.
  meta          Adds, updates, deletes, and lists post custom fields.
  term          Adds, updates, removes, and lists post terms.
  update        Updates one or more existing posts.


    # Create a new post.
    $ wp post create --post_type=post --post_title='A sample post'
    Success: Created post 123.

    # Update an existing post.
    $ wp post update 123 --post_status=draft
    Success: Updated post 123.

    # Delete an existing post.
    $ wp post delete 123
    Success: Trashed post 123.

See also