#61495 closed enhancement (fixed)
Block Hooks: Refactor update_ignored_hooked_blocks_postmeta to use meta_input
Reported by: | tomjcafferkey | Owned by: | Bernhard Reiter |
---|---|---|---|
Milestone: | 6.7 | Priority: | normal |
Severity: | normal | Version: | 6.6 |
Component: | General | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
The function update_ignored_hooked_blocks_postmeta
uses the core function update_post_meta()
to write _wp_ignored_hooked_blocks
data to the database during an operation that is preparing a post to be inserted.
Since we have access to the incoming changes that is being prepared we can remove this database operation in favour of writing the data to the post object provided under meta_input
.
Doing this means two things:
- It allows us to store postmeta for new posts that are about to be created since they don't have an
ID
yet (which is informationupdate_post_meta()
needs). - The core controller will take care of updating postmeta in a more predictable pattern.
Change History (4)
This ticket was mentioned in PR #6885 on WordPress/wordpress-develop by @tomjcafferkey.
3 months ago
#1
- Keywords has-patch has-unit-tests added
#3
@
3 months ago
- Owner set to Bernhard Reiter
- Resolution set to fixed
- Status changed from new to closed
In 58578:
@Bernhard Reiter commented on PR #6885:
3 months ago
#4
Committed to Core trunk
in https://core.trac.wordpress.org/changeset/58578.
Note: See
TracTickets for help on using
tickets.
This is a prerequisite to adding hooked blocks to template parts at positions
first_child
andlast_child
https://github.com/WordPress/wordpress-develop/pull/6867It's necessary because unlike
wp_navigation
post, thewp_template_part
posts won't have a database entry upon first save meaning thatupdate_post_meta
won't work. To circumvent this we are now setting meta information on the$post
stdClass object via themeta_input
field which will get saved as post meta when its created/updated in the database.Trac ticket: https://core.trac.wordpress.org/ticket/61495