Disable Jetpack_Sync_Module_Posts action
-
How does one disable the Jetpack_Sync_Module_Posts class from hooking into the transition_post_status action?
Previously one could search for the add-on name and disable it but that seems to have changed from v12.4 to v12.7.
Here is the code I used previously:
global $wp_filter; $hook = 'transition_post_status'; $filters = $wp_filter[ $hook ]; if ( is_object( $filters ) ) $filters = $filters->callbacks; else return; foreach( $filters as $priority => $callbacks ) { foreach( $callbacks as $callback ) { // We're looking for a class. $function = $callback[ 'function' ]; if ( ! is_array( $function ) ) continue; $callback_class = $function[ 0 ]; if ( ! is_object( $callback_class ) ) continue; // We are looking for Jetpack. if ( get_class( $callback_class ) != 'Jetpack_Sync_Module_Posts' ) continue; $function_name = $function[ 1 ]; // And this specific function. if ( $function_name != 'save_published' ) continue; // Found it. Remove it. $this->debug( 'Removing transition_post_status action for the post sync module.' ); remove_action( $hook, $callback[ 'function' ], $priority, $callback[ 'accepted_args' ] ); } }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Disable Jetpack_Sync_Module_Posts action’ is closed to new replies.