Archived topic
Auto refresh preview page
9 replies · Started by Dan on November 19, 2019
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.
Hi there,
do you have any custom functions in a Child Theme or the GP Hooks?
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.
Just to be clear - is it the Preview window that returns to the Top when it is updated? Or the editor window?
It's the preview page - the editor stays the same.
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.
So it's more likely to be a Wordpress issue?
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 ).
Hi I gave the code a try but it didn't work.
Cheers.
Odd its working for me - do you want to add the script and remove the Users display rule so i can take a look?