If i have pages that point to somefilename.php
and want to change the filename to betterfilename.php
, can I leave the template comments unchanged without manually changing all the pages?
/*
Template Name: Some File Name
*/
If i have pages that point to somefilename.php
and want to change the filename to betterfilename.php
, can I leave the template comments unchanged without manually changing all the pages?
/*
Template Name: Some File Name
*/
You must be logged in to post a comment.
Chris gave me some good insight, and I appreciate the filter func. But I wound up changing the db through phpMyAdmin:
When you select a page template, WordPress stores it as postmeta with the key
_wp_page_template
. The value that gets stored is the actual page template path relative to the template directory (or stylesheet directory).So when WP looks for the template to include, it will for
somefilename.php
and when it doesn’t find it, it will fall back to thepage.php
.You can see the files WP searches for in the functions
get_page_template
andget_page_template_slug
Best solution: go update your pages. Other, less manual solution: hook into
page_template
and look for the old filename, replace it with the new:As a plugin.