PHP snippet to change the WordPress template dropdown to default to another template.
Create a new file and add this code:
<?php
function set_default_page_template($post_id, $post, $update) {
if ($post->post_type !== 'page' || $update) return;
// Only run on first save
$default_template = 'templates/flexible-layout.php'; // Path relative to theme root
update_post_meta($post_id, '_wp_page_template', $default_template);
}
add_action('save_post', 'set_default_page_template', 10, 3);
Import it in your functions.php file:
get_template_part('functions/set-default-page-template');