Wp post meta (WP-CLI)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

wp post meta: Manage custom (meta) fields

$ wp help post meta

NAME

  wp post meta

DESCRIPTION

  Adds, updates, deletes, and lists post custom fields.

SYNOPSIS

  wp post meta <command>

SUBCOMMANDS

  add         Add a meta field.
  delete      Delete a meta field.
  get         Get meta field value.
  list        List all metadata associated with an object.
  patch       Update a nested value for a meta field.
  pluck       Get a nested value from a meta field.
  update      Update a meta field.

EXAMPLES

    # Set post meta
    $ wp post meta set 123 _wp_page_template about.php
    Success: Updated custom field '_wp_page_template'.

    # Get post meta
    $ wp post meta get 123 _wp_page_template
    about.php

    # Update post meta
    $ wp post meta update 123 _wp_page_template contact.php
    Success: Updated custom field '_wp_page_template'.

    # Delete post meta
    $ wp post meta delete 123 _wp_page_template
    Success: Deleted custom field.

Zie ook