/ 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 :
Code :

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.


Most Popular

Leave a Reply

Your email address will not be published.