Wp post meta get (WP-CLI): verschil tussen versies
Naar navigatie springen
Naar zoeken springen
(Nieuwe pagina aangemaakt met ''' wp post meta get'': Verkrijg de waardes voor een bepaald meta-object. Oftewel: Wat staat er in het <code>value</code>-veld in tabel <code>wp_postmeta</code> voor...') |
|||
Regel 1: | Regel 1: | ||
− | '' wp post meta get'': | + | '' wp post meta get'': Get the values for a particular meta object. In other words: What does the <code>value</code> field in table <code>wp_postmeta</code> say for this <code>id</code> and this <code>key</code>. This works for both scalars and serialized data. |
<pre> | <pre> | ||
− | + | $ wp help post meta get | |
NAME | NAME |
Versie van 29 aug 2022 12:03
wp post meta get: Get the values for a particular meta object. In other words: What does the value
field in table wp_postmeta
say for this id
and this key
. This works for both scalars and serialized data.
$ wp help post meta get NAME wp post meta get DESCRIPTION Get meta field value. SYNOPSIS wp post meta get <id> <key> [--format=<format>] OPTIONS <id> The ID of the object. <key> The name of the meta field to get. [--format=<format>] Get value in a particular format. --- default: var_export options: - var_export - json - yaml ---
Voorbeelden
Gebaseerd op het voorbeeld hieronder tav. wp post meta list
:
wp post meta get 7 hero_text <!-- First version - Until 2020.09.25 <h2>BlahBlah</h2> --> <!-- <h2>BlahBlah-2</h2> --> <h2>BlahBlah-3</h2>
Dit werkt ook voor serialised data:
wp post meta get 7 banner_pick_tool_link array ( 'title' => 'Onze widget-Keuzehulp >', 'url' => 'http://en.s1/widget-keuzehulp/', 'target' => '', )
Hoe je parameters kunt gebruiken in de argumenten: Alledrie de varianten werken:
id=7 bb=3 wp post meta get 7 buttonbars_3_buttonbar_title wp post meta get 7 buttonbars_${bb}_buttonbar_title wp post meta get $id buttonbars_${bb}_buttonbar_title