aguko
Post count: 43
|
I wrote the following codes in function.php, in order to change and update the value of the custom field set as media .
https://gist.github.com/aguko/931c131d25d3978eb2b6
Although the title was updated, the custom field was not update.
Is there how to write others?
|
traversal
Post count: 207
|
Hi, try using the “mp_after_save_meta” action instead, like so:
https://gist.github.com/traversal/ed1eb9a033a51e44b35d
|
aguko
Post count: 43
|
Change of a title and a custom field was not completed in my environment…
|
traversal
Post count: 207
|
Hi Kosuke,
Sorry about the delayed reply. I’ve recreated this properly, and realised my code was incorrect. Furthermore, if you try to use the MasterPress API to update fields against an attachment while the attachment is being updated, you’ll end up with an infinite loop! I’ve updated the gist now to show you a workaround for this:
https://gist.github.com/traversal/ed1eb9a033a51e44b35d
Basically, use the native update_post_meta function instead to update the value, and you should be okay. Hopefully that’s okay for the moment.
|
aguko
Post count: 43
|
Very thank you!
I was able to update the field.
|