#61495 closed enhancement (fixed)
Block Hooks: Refactor update_ignored_hooked_blocks_postmeta to use meta_input
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| 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
IDyet (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.
2 years ago
#1
- Keywords has-patch has-unit-tests added
#3
@
2 years ago
- Owner set to Bernhard Reiter
- Resolution set to fixed
- Status changed from new to closed
In 58578:
@Bernhard Reiter commented on PR #6885:
2 years 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_childandlast_childhttps://github.com/WordPress/wordpress-develop/pull/6867It's necessary because unlike
wp_navigationpost, thewp_template_partposts won't have a database entry upon first save meaning thatupdate_post_metawon't work. To circumvent this we are now setting meta information on the$poststdClass object via themeta_inputfield which will get saved as post meta when its created/updated in the database.Trac ticket: https://core.trac.wordpress.org/ticket/61495