[wp-trac] [WordPress Trac] #58532: Improve performance and simplify usage of `block_has_support()` by supporting a string feature and avoiding `_wp_array_get()` for them
WordPress Trac
noreply at wordpress.org
Thu Aug 10 16:47:17 UTC 2023
#58532: Improve performance and simplify usage of `block_has_support()` by
supporting a string feature and avoiding `_wp_array_get()` for them
---------------------------------------------+--------------------------
Reporter: flixos90 | Owner: thekt12
Type: enhancement | Status: closed
Priority: normal | Milestone: 6.4
Component: Editor | Version: 5.8
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests commit | Focuses: performance
---------------------------------------------+--------------------------
Changes (by flixos90):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"56382" 56382]:
{{{
#!CommitTicketReference repository="" revision="56382"
Editor: Simplify usage of `block_has_support()` function by supporting a
string.
Most block feature checks are for a single feature string, and for such
cases it is not intuitive to require an array for the `$feature` parameter
of the `block_has_support()` function.
This changeset brings it in line with other functions like
`post_type_supports()`, allowing to pass a string for the `$feature`. An
array is still supported for more complex cases where support for sub-
features needs to be determined. This change furthermore includes a very
minor performance tweak by avoiding calls to the `_wp_array_get()`
function if a single feature string is being checked for.
Props thekt12, nihar007, mukesh27, swissspidy.
Fixes #58532.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58532#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list