我想知道你是否可以使用这样简单的东西:(类似于@ialocin的建议)
/**
* Use the "Force" on the post status ;-)
*/
add_action( \'wp_insert_post_data\', function( $data, $postarr ){
$change_post_status = array( \'draft\', \'private\' ); // Edit to your needs
if( \'cpt\' === $data[\'post_type\']
&& in_array( $data[\'post_status\'], $change_post_status, TRUE )
)
$data[\'post_status\'] = \'publish\';
return $data;
}, PHP_MAX_INT, 2 );
当post状态值是
$change_post_status
数组-保存帖子之前。
(…或者我可能误解了设置;-)