File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -625,10 +625,17 @@ private function get_formatter( &$assoc_args ) {
625625 * @return string A comma-separated list of action callbacks, or 'None' if no actions are registered.
626626 */
627627 protected static function get_hook_actions ( $ hook_name ) {
628+ static $ cache = array ();
629+
630+ if ( isset ( $ cache [ $ hook_name ] ) ) {
631+ return $ cache [ $ hook_name ];
632+ }
633+
628634 global $ wp_filter ;
629635
630636 if ( ! isset ( $ wp_filter [ $ hook_name ] ) ) {
631- return 'None ' ;
637+ $ cache [ $ hook_name ] = 'None ' ;
638+ return $ cache [ $ hook_name ];
632639 }
633640
634641 $ hook = $ wp_filter [ $ hook_name ];
@@ -642,9 +649,12 @@ protected static function get_hook_actions( $hook_name ) {
642649 }
643650
644651 if ( empty ( $ callbacks ) ) {
645- return 'None ' ;
652+ $ cache [ $ hook_name ] = 'None ' ;
653+ return $ cache [ $ hook_name ];
646654 }
647655
656+ ksort ( $ callbacks );
657+
648658 $ actions = array ();
649659
650660 // Iterate through all priorities
@@ -658,7 +668,9 @@ protected static function get_hook_actions( $hook_name ) {
658668 }
659669 }
660670
661- return implode ( ', ' , $ actions );
671+ $ result = empty ( $ actions ) ? 'None ' : implode ( ', ' , $ actions );
672+ $ cache [ $ hook_name ] = $ result ;
673+ return $ cache [ $ hook_name ];
662674 }
663675
664676 /**
You can’t perform that action at this time.
0 commit comments