/* Do something with the data entered */
add_action( \'save_post\', \'myplugin_save_postdata\' );
/* When the post is saved, saves our custom data */
function myplugin_save_postdata( $post_id ) {
// First we need to check if the current user is authorised to do this action.
if ( \'page\' == $_POST[\'post_type\'] ) {// checks for post type.
if ( ! current_user_can( \'edit_page\', $post_id ) )
return;
} else {
if ( ! current_user_can( \'edit_post\', $post_id ) )
return;
}
$mydata = get_post_meta($post_id,\'speaker\',true);
update_post_meta( $post_id, \'_your_meta_key\', $mydata ); // replace your _your_meta_key with Episode Titles key
}
这可能是你需要的。当前代码仅适用于页面,但也可以修改为适用于POST或CPT。
它从你的演讲者字段中获取数据,并将该值更新到你的剧集标题中。请确保为您的Episode Titles