From 68302633c0d7a5d7003908d48e481980bb4c623e Mon Sep 17 00:00:00 2001 From: Andrey Savchenko Date: Fri, 2 Dec 2016 19:18:41 +0200 Subject: [PATCH] Restored functionality on WP 4.7 beta with new current_priority() method. --- src/class-laps.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/class-laps.php b/src/class-laps.php index 2a46c59..0ba582c 100644 --- a/src/class-laps.php +++ b/src/class-laps.php @@ -91,15 +91,12 @@ class Laps { global $wp_filter; - $filter = current_filter(); - $priority = key( $wp_filter[ $filter ] ); - - if ( 'callbacks' === $priority ) { // Fails on WP 4.7, see https://core.trac.wordpress.org/ticket/39007 - return $input; - } + $filter_name = current_filter(); + $filter_instance = $wp_filter[ $filter_name ]; + $priority = $filter_instance instanceof \WP_Hook ? $filter_instance->current_priority() : key( $filter_instance ); $event = wp_parse_args( - self::$events[ $filter ][ $priority ], + self::$events[ $filter_name ][ $priority ], array( 'action' => 'start', 'category' => null,