Opened 2 years ago
Last modified 2 years ago
#56700 new defect (bug)
wp_update_post function not support meta update
Reported by: | borisolhor | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | |
Focuses: | Cc: |
Description
Hi.
Seems like wp_update_post() function not support meta fields update.
I found post meta update only in wp_insert_post() function https://github.com/WordPress/wordpress-develop/blob/6.0.2/src/wp-includes/post.php#L4498-L4502
Is there are some reasons to not include meta fields update in wp_update_post() function? Or this can be fixed in the future?
Note: See
TracTickets for help on using
tickets.
@borisolhor Thanx for the ticket and welcome to Trac!
If you look at https://github.com/WordPress/wordpress-develop/blob/6.0.2/src/wp-includes/post.php#L4775 you'll see that
wp_update_post()
is basically just a small wrapper aroundwp_insert_post()
. So, the$postarr['meta_input']
values passed to it will be updated by the code you referenced withinwp_insert_post()
.