Opened 4 years ago
Last modified 4 years ago
#56700 new defect (bug)
wp_update_post function not support meta update
| Reported by: | borisolhor | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Posts, Post Types | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
@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().