Wordpress Add Post Meta

Add Wordpress Add Post Meta

Add a custom field (also called metadata) to a specific post that can be of any post type. Check the ID of the post. In order to do this, add the following line of code directly below the opening PHP tag.

<font color="#ffff00">Description

Add a user-defined box (also known as a metadata field) to a specific post that can be of any post you like. Because a user-defined box is virtually a key-value couple. Notice that if the specified code already existed between the user-defined cells of the specified post, another user-defined cell with the same code will be added, unless the $unique key is changed to True, in which case no changes will be made.

When you want to upgrade the value of an existent encryption code, use the update_post_meta() instead. boolean|integer × If successful, return the ID of the pasted line confirmed as tru. Return value incorrect if the $unique parameter is flagged truthful and a user-defined array already exist with the specified number.

Update_post_meta ( 7,'fruit','banana'); Add a new user-defined array only if a user-defined array with the specified encryption is not already present:

Add several user-defined arrays with different value, but with the same value'my_key': ... A full example can be found on the post_meta Functions Examples page. For example, this can be used to unusually show these user-defined arrays with the add_meta_box() command. For example, add a distinct user-defined array with the pathname'_color' and value'red', but this user-defined array will not appear on the monitor after editing.

Also, if the $meta_value parameter is an array, it will not be shown on the page editing page even if you do not precede the code name with an asterisk. The use of the flag flag out of the field under " is_protected_meta" is an alternate to the use of a "_" (underscore). Since meta data is provided by the stripslashes() functions, you must make sure that any contents that escape with the \ sign are handled carefully.

For more information about the behaviour and a sample work-around, see the update_post_meta() document.

Auch interessant

Mehr zum Thema