Automatically select template based on query string for New Posts
You can definitely accomplish this via the new_to_auto-draft action. This works because wp_insert_post has just finished taking the template from the post array and updating the meta to reflect this. You will essentially overwrite this value in the database right after it’s set. Here’s an example: function my_project_change_default_template( $post ) { if ( ! strpos( … Read more