Opened 2 days ago
Last modified 2 days ago
#64449 new enhancement
Block support: Add server-side processing for anchor
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 7.0 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Editor | Keywords: | gutenberg-merge |
| Focuses: | Cc: |
Description
Gutenberg PR: https://github.com/WordPress/gutenberg/pull/74183
We are adding anchor (id) support to dynamic blocks. Dynamic blocks are rendered server-side, so we need to process the ID attribute value to output it.
Change History (2)
This ticket was mentioned in PR #10655 on WordPress/wordpress-develop by @wildworks.
2 days ago
#1
- Keywords has-patch has-unit-tests added
#2
@
2 days ago
- Keywords has-patch has-unit-tests removed
Testing instructions
WordPress core does not yet have any dynamic blocks that support anchors, so run the following code to add anchor support to the Archive block:
add_filter( 'register_block_type_args', function( $args, $block_name ) {
if ( 'core/archives' === $block_name ) {
$args['supports']['anchor'] = true;
}
return $args;
}, 10, 2 );
- Open a post.
- Switch to Code Editor mode and enter the following HTML:
<!-- wp:archives {"anchor":"my-anchor"} /--> - Save the post.
- On the frontend, the Archive block should have an ID attribute.
Note: See
TracTickets for help on using
tickets.
Trac ticket: https://core.trac.wordpress.org/ticket/64449