This is the way I always do it…
add_action( 'save_post', 'header_setting_generate', 99 );
function header_setting_generate($post_id) {
global $post;
if(isset($_POST['post_type']) && ($_POST['post_type'] == "page")){
$value = array(
'header-settings' => 'page-data',
);
update_post_meta( $post_id, '_skoty-page-header-settings', $value);
}
}
After inserting this code, go to “Pages”, Select All, click Bulk Edit, Change status to “Published” just to trigger a save_post on all pages. This should generate it.