The feature did work in the past however pages now seem to default to ‘Default Template’.
I can see my available page templates in the drop-down on the Page edit page, however after saving the admin simply shows ‘Default Template’ again.
I have tried disabling all plugins as well as remaking some of the templates, however the behaviour continues.
Any ideas?
Note: I’m using latest self-hosted WordPress.
Update: After some digging it would appear that I am getting ‘Table xxx/wp_postmeta’ is marked as crashed and should be repaired”. However running repair through phpmyadmin does not fix the issue.
Update: Rebuilt the table entirely, still have issue.
(Originally posted this question here: https://webapps.stackexchange.com/questions/33627/wordpress-page-edit-does-not-save-selected-template)
I had the same issue and it was caused by WPML. I deactivated the option “Synchronize page template” in the WPML translation options and it finally worked.
It sounds like your WordPress installation is coruppted. I’d try removing all of the files (except perhaps the
wp-content/
folder and thewp-config.php
and.htaccess
files), and then uploading a fresh installation of WordPress.Create a new MySQL database, if you can, and run the WordPress installer. After installation, you can try importing your blog content back using the Tools menu in the WordPress administration dashboard.
It’s also a good idea to check for bad code. You’ve probably already tried reverting to the default theme (Twenty Ten, Twenty Eleven, Twenty Twelve), and disabling all plugins, but you also need to check if there’s any files in the
wp-content/mu-plugins
directory, if it exists.Good luck solving the problem.
Turns out this was an issue with my hosting.
phpmyadmin although reporting operations as complete was not actually committing repairs / optimisations. Now querying why this is with the company.
So the simple fix was indeed to simply repair + optimise the table.
I had the same problem and solved it.
I solved it by going to the table wp_postmeta (through phpMyAdmin) and just edit the record where:
I have changed the
_wp_page_template
‘s meta_value todefault
Hope it works!
Just a quick note after reading Björn Weinbrenner’s answer:
If you’re good with all translations having the same template, there’s no need to turn off “Synchronize page template”.
In this case, the reason the template value is reverting after you save is because you’re changing it on a translation of the original page. Just change the template on the same page in the main language and the value will be preserved.
This is the correct procedure, unless you really need a different template on a specific language.