[Support request] Auto refresh preview page

Home Forums Support Auto refresh preview page

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1067694
    Dan

    Hi,

    Since the new WP update, whenever I make a change to the WP text editor and I have the preview page open, the page auto refreshes and goes back to the top of the page (makes editing slower).

    I posted on the WP forum and they said it wasn’t them.

    I deactivated all plugins and installed 2020 theme in troubleshooting mode – the problem went away.

    I switched back to normal mode and reactivated Generatepress but left all the plugins off – the problem returned.

    If you could provide some thoughts on how to fix that would be great.

    Site:

    Thanks.

    #1067709
    David
    Staff
    Customer Support

    Hi there,

    do you have any custom functions in a Child Theme or the GP Hooks?

    #1067715
    Dan

    Hi,

    I have a hook using the elements for Amazon One Link plus the copyright element for the copyright in the footer. No child theme.

    #1067852
    David
    Staff
    Customer Support

    Just to be clear – is it the Preview window that returns to the Top when it is updated? Or the editor window?

    #1068101
    Dan

    It’s the preview page – the editor stays the same.

    #1068317
    David
    Staff
    Customer Support

    I am not sure it this is a browser, install or setup thing – but i just tested GP, TwentyNineteen and TwentyTwenty and all three refresh the page back to the top.

    #1068322
    Dan

    So it’s more likely to be a WordPress issue?

    #1068644
    David
    Staff
    Customer Support

    I think its more related to the browser and WP doesn’t pass any script to counter the default scrollTop position on refresh.

    You’re site is using jQuery so you could try this script.

    <script>
    $(window).scroll(function() {
      sessionStorage.scrollTop = $(this).scrollTop();
    });
    
    $(document).ready(function() {
      if (sessionStorage.scrollTop != "undefined") {
        $(window).scrollTop(sessionStorage.scrollTop);
      }
    });
    </script>

    You can add it to your site using a Hook Element:

    1. Create New Hook.
    2. Add the Script to the content
    3. Select the WP_footer hook
    4. Select Display Rules –
    Location: Entire Site
    Users: Logged In ( so it won’t effect visitors ).

    #1068914
    Dan

    Hi I gave the code a try but it didn’t work.

    Cheers.

    #1069306
    David
    Staff
    Customer Support

    Odd its working for me – do you want to add the script and remove the Users display rule so i can take a look?

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.