mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-04 17:20:07 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@56678 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user