是的,过滤器是关键!我将此作为类的一部分,并且似乎运行正常:
add_filter('wpdc_publish_after_save', [$this, 'prevent_autopublish_for_konyv'], 10, 3);
public function prevent_autopublish_for_konyv($publish_to_discourse, $post_id, $post)
{
if ('konyv' === get_post_type($post)) {
return false; // Prevent auto-publishing for 'konyv' post type
}
return $publish_to_discourse; // Allow normal behavior for other post types
}