解决方案正在使用added_post_meta
和updated_post_meta
钩
这是工作代码。
add_action( \'added_post_meta\', \'add_custom_field_automatically\', 10, 4 );
add_action( \'updated_post_meta\', \'add_custom_field_automatically\', 10, 4 );
function add_custom_field_automatically( $meta_id, $post_id, $meta_key, $meta_value )
{
if ( \'_my_meta_key\' == $meta_key ) {
add_post_meta($post_id, \'_my_new_meta_key\', $meta_value.\'to something new\', true);
}
}