您可以使用$_REQUEST
, 请尝试以下代码:
add_action(\'publish_post\', \'save_content_to_field\');
function save_content_to_field($post_ID) {
if(isset($_REQUEST[\'content\'])) {
update_post_meta($post_ID, \'desc\', $_REQUEST[\'content\']);
}
}
UPDATED如果您想使用快捷代码支持,请使用以下代码:
add_action(\'publish_post\', \'save_content_to_field\');
function save_content_to_field($post_ID) {
$post = get_post($post_ID);
$result = apply_filters(\'the_content\',$post->post_content);
if($result) {
update_post_meta($post_ID, \'desc\', $result);
}
}