Is it possible to set default values for custom fields in a custom post type while my plugin is being activated?
you can do that on a save_post_ hook try that : add_action(“save_post_” . CUSTOM_POST_TYPE, function ($post_ID, \WP_Post $post, $update) { if (!$update) { update_post_meta($post->ID, “cx_number”, “default value”); return; } if (isset($_POST[“cx_number”])) { update_post_meta($post->ID, “cx_number”, $_POST[“cx_number”]); } }, 10, 3);