add_action("init", function() { $keys = [ "_yoast_wpseo_title", "_yoast_wpseo_metadesc", "_yoast_wpseo_focuskw", "_yoast_wpseo_canonical", "_yoast_wpseo_opengraph-title", "_yoast_wpseo_opengraph-description" ]; foreach ($keys as $k) { register_post_meta("post", $k, [ "show_in_rest" => true, "single" => true, "type" => "string", "auth_callback" => function() { return current_user_can("edit_posts"); } ]); } });