• When editing a page in WordPress, if I select a different template and click the Preview button, the old page template is still being used in the page preview. I thought it might be a bug caused by a plugin at first, but the same thing occurs on a fresh WordPress installation.

    Is this the default, “correct” behaviour? And if so, how should I go about editing existing pages that need to use a new page template? Creating new pages and dealing with redirections or page renaming afterwards seems much too messy to be the best solution…

    Thanks in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello Emilep – this may be a cache issue on your server. It doesn’t sound like a correct default function. Can you test that previewing feature by changing your theme momentarily? If you change the theme (don’t delete your current theme – just activate a new theme for a moment and then test the preview feature – you can see if it’s a glitch in the theme. You may need to connect directly with the theme authors.

    Thread Starter emilep

    (@emilep)

    I’ve tried with two completely different themes, and the two WordPress installations I’ve been testing on are on two different servers – one of which is a very simple LAMP setup with no other sites on it and no special caching modules or anything like that. I’ve also disabled browser caching during my tests. Still, the same issue arises. :/

    Have you disabled all plugins and tested again? Sounds like a potential plugin conflict then. Are you using a page builder like Visual Composer?

    Thread Starter emilep

    (@emilep)

    Yes, I’ve tried that: the clean WordPress installation I’ve been testing on has no plugins, so it cannot be a plugin conflict.

    • This reply was modified 6 years, 8 months ago by emilep.

    Sounds like a theme conflict then. Have you contacted the theme authors directly on their email or support forum?

    Thread Starter emilep

    (@emilep)

    The theme I’m using on the fresh install is a rather simple one I made myself – it only has the “default” template and an empty template with a simple get_header(), get_footer() and a big H1 in the middle which allows me to see whether or not the right template is being displayed or not in the page preview.

    This is the testing template, called template-default.php, :

    <?php
    /*
    Template Name: Par défaut (template-default)
    */
    
    get_header(); 
    ?>
    
    <h1 style="color: black;">This is the default layout!</h1>
    
    <?php
    get_footer(); 
    ?>

    The functions.php is empty except for the CSS and JS includes (and the issue remains when emptying the functions.php).

    Just to specify, the templates work correctly when saving – it’s just the Preview feature that doesn’t work correctly (it always uses the page’s current template instead of the one that’s currently selected in the Edit page)

    • This reply was modified 6 years, 8 months ago by emilep.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Page preview doesn’t take template change into account’ is closed to new replies.