Make WordPress Core

Opened 21 months ago

Last modified 21 months ago

#56700 new defect (bug)

wp_update_post function not support meta update

Reported by: borisolhor's profile 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?

Change History (1)

#1 @pbiron
21 months ago

@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 around wp_insert_post(). So, the $postarr['meta_input'] values passed to it will be updated by the code you referenced within wp_insert_post().

Note: See TracTickets for help on using tickets.