query.update_post_meta
/ Database / query.update_post_meta
Title | : | query.update_post_meta | |||||
Purpose | : | Updates a post meta field based on the given post ID. | |||||
Syntax | : |
|
|||||
Input Parameters | : | post_id, meta_key, meta_value, prev_value | |||||
Return Value | : | Meta ID if the key didn’t exist, true on successful update, false on failure or if the value passed to the function is the same as the one that is already in the database. | |||||
Example 1 | : |
|
There is second approach which can use in bulk meta update.
- In this you can pass multiple parameter json to update_post_meta
- consider following snippet of code.
- Three parameters are passed as json for updation.
- Rather than using single line update for each, you can better way use this to update as bulk.
1 2 3 4 5 6 |
[query.update_post_meta post_id="{post_id}"] { "job_location":"pune", "job_qualification":"graduate", "job_positions":"developer"} [/query.update_post_meta] |