我使用URL参数并创建了一个在init调用的特定函数:
add_action( \'init\', \'publish_post_status\' );
function publish_post_status($post_id){
if (isset($_GET[\'publish\']) && current_user_can(\'publish_posts\')) {
if ($_GET[\'publish\'] == "true") {
$current_post = get_post( $_GET[\'post_id\'], \'ARRAY_A\' );
$current_post[\'post_status\'] = \'publish\';
wp_update_post($current_post);
}
}
if (isset($_GET[\'queue\'])) {
if ($_GET[\'queue\'] == "true") {
$current_post = get_post( $_GET[\'post_id\'], \'ARRAY_A\' );
$current_post[\'post_status\'] = \'pending\';
wp_update_post($current_post);
}
}
}