Wp post meta update (WP-CLI)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

wp post meta update: Update an existing non-serialised meta field:

  • id: ID of the page or post
  • key: Name of the field or object
$ wp help post meta update

NAME

  wp post meta update

DESCRIPTION

  Update a meta field.

SYNOPSIS

  wp post meta update <id> <key> [<value>] [--format=<format>]

ALIAS

  set

OPTIONS

  <id>
    The ID of the object.

  <key>
    The name of the meta field to update.

  [<value>]
    The new value. If omitted, the value is read from STDIN.

  [--format=<format>]
    The serialization format for the value.
    ---
    default: plaintext
    options:
      - plaintext
      - json
    ---

Example

contact_page_id=101
contact_page_content_meta_key="contact_tekst_en_formulier"

contact_page_content='Wir würden gerne von Ihnen hören! '
contact_page_content+='Während der Bürozeiten sind wir in der Regel sehr schnell mit Antworten.<br><br>'

wp post meta update $contact_page_id $contact_page_content_meta_key "$contact_page_content"

See also