• Resolved sjgarth

    (@sjgarth)


    Hi,
    I have a site with specific menus depending on whether the user is logged in or not (using plugin ‘If Menu’). The HOME page is a static page with minimal navigation menu items for logged out, and once logged in many more menu items appear.
    However, due to local browser cache the menu doesn’t always change once logged in, so the user doesn’t see the extra menu items until they do a reload via F5.
    This is far from ideal.
    Is there any way I can get the home page to automatically reload after logging in so that the user can see the full menu immediately?
    A number of plugins will refresh a page every x minutes, but not on login.
    Any ideas gratefully received.

    • This topic was modified 4 years, 7 months ago by sjgarth.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    I don’t think simply reloading the page will accomplish your goal. The browser is likely to load from its cache again anyway. A common way to circumvent browser caching is to append ?version=2008071222 or similar timestamp to URLs. You could use the “login_redirect” filter to send logged in users elsewhere or to modify the default location.

    You need to take care to append with an ? or &, depending on whether there are other query args or not. add_query_arg() handles this for you. Untested, but maybe something like this added to your theme’s functions.php:

    add_filter('login_redirect', function( $link ) {
      return add_query_arg('ver', time(), $link );
    });
    Thread Starter sjgarth

    (@sjgarth)

    That has worked, thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Automatic Page Refresh’ is closed to new replies.