• I don’t know if this is something that has happened since moving to WP 3.8 (as it seems a lot of things have gone wrong since that move) however on my website I have a number of custom pages that use page templates that no longer work e.g they are all using the default template.

    These were all working the last time I looked at them (I cannot remember if this was before or after the upgrade to 3.8)

    I can see all the templates in the template dropdown box so WP must be picking them up from the directory. However whenever I edit one of the pages and set the page to the desired template and save it after submission it has reverted back to “default template” in the list box.

    The page is under the right parent page.

    I have tried disabling / de-connecting Jetpack as that has been a cause of a number of issues since I installed it.

    The comments at the top of the template file are correct and the content of these template files haven’t changed at all.

    I haven’t installed any new plugins or changed my theme.

    The only thing I have done recently is upgrade to WP 3.8

    Is there something in the DB I can edit to force a page to use a template?

    I know MySQL so if that’s the quickest way to fix this then I will do it. I just don’t want half my site looking bare as bones because none of the templates are working.

    I get no error message when I save the page. It just comes back with “Default Template” selected instead of the one I select from the drop down list below.

    Is there some change in 3.8 I need to do for page templates in the comment section or a setting I need to check?

    If there is anyway I can debug this please let me know. I can code so let me know what to check to see if I can use to find the cause of the issue.

    And yes I have tried the de-activate all plugins trick etc.

    Any help would be much appreciated.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter strictly-software

    (@strictly-software)

    Right, I turned on wp_debug as I submitted the form and got a load of SQL errors like this.

    WordPress database error: [Incorrect file format ‘a’]
    SELECT * FROM wp_postmeta a, wp_posts b WHERE a.post_id=b.ID AND b.post_status!=’trash’ AND (a.meta_key = ‘_pprredirect_active’ OR a.meta_key = ‘_pprredirect_rewritelink’ OR a.meta_key = ‘_pprredirect_newwindow’ OR a.meta_key = ‘_pprredirect_relnofollow’ OR a.meta_key = ‘_pprredirect_type’ OR a.meta_key = ‘_pprredirect_url’) ORDER BY a.post_id ASC;

    WordPress database error: [Incorrect file format ‘wp_postmeta’]
    SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (7381) ORDER BY meta_id ASC

    WordPress database error: [Incorrect file format ‘wp_postmeta’]
    SELECT meta_id FROM wp_postmeta WHERE meta_key = ‘_edit_last’ AND post_id = 7381

    WordPress database error: [Incorrect file format ‘wp_postmeta’]
    INSERT INTO wp_postmeta (post_id,meta_key,meta_value) VALUES (7381,’_edit_last’,’1′)

    WordPress database error: [Incorrect file format ‘wp_postmeta’]
    SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (7381) ORDER BY meta_id ASC

    WordPress database error: [Incorrect file format ‘wp_postmeta’]
    SELECT meta_id FROM wp_postmeta WHERE meta_key = ‘_wp_page_template’ AND post_id = 7381

    WordPress database error: [Incorrect file format ‘wp_postmeta’]
    INSERT INTO wp_postmeta (post_id,meta_key,meta_value) VALUES (7381,’_wp_page_template’,’Calculator.php’)

    WordPress database error: [Incorrect file format ‘wp_postmeta’]
    SELECT meta_id FROM wp_postmeta WHERE meta_key = ‘s2member_ccaps_req’ AND post_id = 7381

    WordPress database error: [Incorrect file format ‘wp_postmeta’]
    SELECT meta_id FROM wp_postmeta WHERE meta_key = ‘sharing_disabled’ AND post_id = 7381

    WordPress database error: [Incorrect file format ‘wp_postmeta’]
    SELECT meta_id FROM wp_postmeta WHERE meta_key = ‘switch_like_status’ AND post_id = 7381

    WordPress database error: [Incorrect file format ‘wp_postmeta’]
    SELECT meta_id FROM wp_postmeta WHERE meta_key = ‘_pprredirect_active’ AND post_id = 7381

    WordPress database error: [Incorrect file format ‘wp_postmeta’]
    SELECT meta_id FROM wp_postmeta WHERE meta_key = ‘_pprredirect_newwindow’ AND post_id = 7381

    WordPress database error: [Incorrect file format ‘wp_postmeta’]
    SELECT meta_id FROM wp_postmeta WHERE meta_key = ‘_pprredirect_relnofollow’ AND post_id = 7381

    WordPress database error: [Incorrect file format ‘wp_postmeta’]
    SELECT meta_id FROM wp_postmeta WHERE meta_key = ‘_pprredirect_type’ AND post_id = 7381

    WordPress database error: [Incorrect file format ‘wp_postmeta’]

    Therefore I am guessing I have some form of corrupt table row which requires a REBUILD. Problem is the site is about to be hit heavily within the next 15 minutes and I have over 20k pages. Do I wait or do I go mmmm. I will let you know how it goes!

    Thread Starter strictly-software

    (@strictly-software)

    Seems like whatever I do, a REPAIR, OPTIMIZE (on extended, quick etc) it comes back with

    Table Op Msg_Type Msg_Text
    .wp_postmeta check Error Incorrect file format ‘wp_postmeta’
    .wp_postmeta check error Corrupt

    As all the errors relate to one row? Can I delete it – the latest backup I have is from December 22nd – this is another issue that seems to have happened with the WP_Database plugin in that it is just not creating scheduled backups and I am having to do them manually.

    Is there a way of restoring ONE table only from a backup?

    Any help much appreciated!

    Thread Starter strictly-software

    (@strictly-software)

    In MS SQL I could restore an old backup DB to a new name, then copy across the table to the other DB.

    Is this not possible in MySQL? I do have some backup files – I just don’t know why the WP DB Manager plugin isn’t backing up regularly on this site thats now screwed BUT is on another site on the same server. It just won’t set any timestamps up for scheduling.

    Thread Starter strictly-software

    (@strictly-software)

    This has been a real nightmare day for me!

    In the end I had to stop Apache, truncate the wp_postmeta table as it was totally corrupt and unfixable by any REPAIR statement.

    I then restored the latest backup I had to a new DB (logged in as root in Navicat) called RESTORE.

    ALWAYS KEEP A BACKUP – NIGHTLY IF POSSIBLE – AND DON’T RELY ON WORDPRESS PLUGINS THEY DON’T ALWAYS WORK!!

    Then I ran a statement to copy over the records from the restored DB into the now empty wp_postmeta table e.g

    insert into ukhorseracingtipster.wp_postmeta
    (post_id,meta_key,meta_value)
    select post_id,meta_key,meta_value
    from restore.wp_postmeta

    Which in my opinion took far too long but anyway it worked. I had to take the sites down whilst doing it but it was the only way.

    Once you get 20k+ posts and all the meta data that comes with it then any REPAIR, OPTIMIZE or INSERT INTO statement seems to take forever with MySQL. Why I don’t know, if the site is off an no other connections are blocking or linking to the table I don’t know why it takes 30+ mins to run such a statement but it does.

    Anyway that was my “fix”.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Suddenly Page Templates Not Working’ is closed to new replies.