Themes: Use instanceof in block_has_support.
In [50761], the block_has_support function was introduced. However, using `property_exists` within this function negatively impacted its performance. This commit replaces the `property_exists` function call with `instanceof WP_Block_Type`, resulting in improved performance. Props mukesh27, gziolo, spacedmonkey. Fixes #59441. Built from https://develop.svn.wordpress.org/trunk@56678 git-svn-id: http://core.svn.wordpress.org/trunk@56190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
73c8507a84
commit
ffad402ba3
|
@ -1589,7 +1589,7 @@ function unregister_block_style( $block_name, $block_style_name ) {
|
|||
*/
|
||||
function block_has_support( $block_type, $feature, $default_value = false ) {
|
||||
$block_support = $default_value;
|
||||
if ( $block_type && property_exists( $block_type, 'supports' ) ) {
|
||||
if ( $block_type instanceof WP_Block_Type ) {
|
||||
if ( is_array( $feature ) && count( $feature ) === 1 ) {
|
||||
$feature = $feature[0];
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.4-alpha-56677';
|
||||
$wp_version = '6.4-alpha-56678';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue