Skip to content

Commit

Permalink
Rephrase the description of Block Hooks in the docs
Browse files Browse the repository at this point in the history
Props to @ockham for proposing edits.
  • Loading branch information
gziolo committed Sep 13, 2023
1 parent 4de6ad5 commit 02fd527
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/reference-guides/block-api/block-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ See the [the variations documentation](/docs/reference-guides/block-api/block-va

Block Hooks is an API that allows a block to automatically insert itself next to all instances of a given block type, in a relative position also specified by the "hooked" block. That is, a block can opt to be inserted before or after a given block type, or as its first or last child (i.e. to be prepended or appended to the list of its child blocks, respectively). Hooked blocks will appear both on the frontend and in the editor (to allow for customization by the user).

The key is the name of the block to hook into, and the value is the position to hook into. Take a look at the [Block Hooks documentation](/docs/reference-guides/block-api/block-registration.md#block-hooks-optional) for more info about available configurations.
The key is the name of the block (`string`) to hook into, and the value is the position to hook into (`string`). Take a look at the [Block Hooks documentation](/docs/reference-guides/block-api/block-registration.md#block-hooks-optional) for more info about available configurations.

### Editor Script

Expand Down
4 changes: 3 additions & 1 deletion docs/reference-guides/block-api/block-registration.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ ancestor: [ 'core/columns' ],
- **Type:** `Object`
- **Since**: `WordPress 6.4.0`

Block Hooks is the API that allows a block to hook into the rendering of another block or multiple blocks. It will enable a block to render its content before or after another block. Alternatively, it's possible to hook into the rendering of a parent block and prepend or append the block to the list of inner blocks. The key is the name of the block (`string`) to hook into, and the value is the position to hook into (`string`). Allowed target values are:
Block Hooks is an API that allows a block to automatically insert itself next to all instances of a given block type, in a relative position also specified by the "hooked" block. That is, a block can opt to be inserted before or after a given block type, or as its first or last child (i.e. to be prepended or appended to the list of its child blocks, respectively). Hooked blocks will appear both on the frontend and in the editor (to allow for customization by the user).

The key is the name of the block (`string`) to hook into, and the value is the position to hook into (`string`). Allowed target values are:

- `before` – inject before the target block.
- `after` - inject after the target block.
Expand Down

0 comments on commit 02fd527

Please sign in to comment.