Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'init', 'remove_jnews_view_counter_hook', 20 );
- function remove_jnews_view_counter_hook() {
- if ( function_exists( 'JNews_View_Counter' ) && class_exists( '\JNEWS_VIEW_COUNTER\Frontend' ) ) {
- if ( JNews_View_Counter()->crawler_detect->is_crawler() ) {
- global $wp_filter;
- if ( isset( $wp_filter['wp_head'] ) ) {
- foreach ( $wp_filter['wp_head']->callbacks as $priority => $callbacks ) {
- foreach ( $callbacks as $key => $callback ) {
- if ( is_array( $callback['function'] ) && $callback['function'][0] instanceof \JNEWS_VIEW_COUNTER\Frontend && $callback['function'][1] === 'register_view_counter' ) {
- remove_action( 'wp_head', array( $callback['function'][0], 'register_view_counter' ), $priority );
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement