[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 3 12:31:10 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:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  6.4
Component:  General                              |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests changes-    |     Focuses:
  requested                                      |  performance
-------------------------------------------------+-------------------------

Comment (by swissspidy):

 > Of course we could also count the items in the array and use isset() if
 it is just 1. But the approach of providing a string brings a similar
 performance improvement and is a more intuitive API.

 I'd suggest doing both, so that plugins and themes doing that will
 automatically benefit from such an enhancement too without having to do
 any code changes.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58532#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list