وردپرس
Disable Jetpack_Sync_Module_Posts action | WordPress.org
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' ] );
}
}
مشاهده پاسخ های این مطلب
———————————————
این مطلب از سایت انجمن وردپرس گردآوری شده است و کلیه حقوق مطلق به انجمن وردپرس می باشد در صورت مغایرت و یا بروز مشکل اطلاع دهید تا حذف گردد
منبع: انجمن وردپرس