Make WordPress Core

Opened 2 years ago

Closed 22 months ago

#56810 closed defect (bug) (fixed)

Wrong doc for block_editor_rest_api_preload()

Reported by: chouby's profile Chouby Owned by: audrasjb's profile audrasjb
Milestone: 6.2 Priority: normal
Severity: normal Version: 5.8
Component: Editor Keywords: has-patch commit
Focuses: docs Cc:

Description

According to the doc, the function block_editor_rest_api_preload() is expecting an array of strings as first parameter.

It's however not true whent the method request is OPTIONS. In this specific case, the preloaded path is an array itself and the path is the first element (index 0) of this array. See for example this usage of the function block_editor_rest_api_preload().

The same mistake is done for the filter block_editor_rest_api_preload_paths and the deprecated filter block_editor_preload_paths.

Attachments (1)

56810.patch (1.9 KB) - added by Chouby 2 years ago.

Download all attachments as: .zip

Change History (5)

@Chouby
2 years ago

#1 @Chouby
2 years ago

  • Keywords has-patch added

#2 @audrasjb
2 years ago

  • Milestone changed from Awaiting Review to 6.2

#3 @audrasjb
22 months ago

  • Keywords commit added

Thanks for spotting this, and for the patch. Looks good to me, marking as ready for commit.

#4 @audrasjb
22 months ago

  • Owner set to audrasjb
  • Resolution set to fixed
  • Status changed from new to closed

In 54776:

Docs: Fix block_editor_rest_api_preload() parameter type.

This changeset fixes the $preload_paths parameter type for block_editor_rest_api_preload() and related hooks. This parameter expects an array of strings OR an array where the path is the first element (index 0) of this array.

Props chouby.
Fixes #56810.
See #56792.

Note: See TracTickets for help on using tickets.