Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to "Reading Settings" do not clear the cache #223

Closed
raamdev opened this issue Jun 18, 2014 · 7 comments
Closed

Changes to "Reading Settings" do not clear the cache #223

raamdev opened this issue Jun 18, 2014 · 7 comments

Comments

@raamdev
Copy link
Contributor

raamdev commented Jun 18, 2014

If changes are made to the WordPress "Reading Settings" (Dashboard → Settings → Reading Settings), the cache is not cleared. This results in a stale version of the site being served.

Steps to reproduce this bug:

  1. In Dashboard → Settings → Reading Settings, set the "Front page displays" option to use a Static page for the home page and another page for the Posts page
  2. Visit the home page to generate a cache file
  3. Go back into Dashboard → Settings → Reading Settings, set the "Front page displays" option to "Your latest posts"
  4. Visit the home page; you'll see that the old cached file (the static home page) is served.

Changes to "Reading Settings" should trigger a wipe of the entire cache, as those settings can affect many different views and therefore many different cache files.

@raamdev raamdev added this to the Future Release milestone Jun 18, 2014
@raamdev
Copy link
Contributor Author

raamdev commented Sep 20, 2014

@jaswsinc I'm not finding anything I can hook into for when the Reading Settings are updated. It looks like I'll need to hook into update_option and then check the option being updated against a list of options that could be updated on the Reading Settings page.

I'd prefer not to do it that way if at all possible, since any changes to option names (or the addition of new options to the Reading Settings page) would require updating the list of options in Quick Cache.

Do you have any other ideas?

@jaswrks
Copy link

jaswrks commented Sep 21, 2014

Maybe something like this...

<?php
add_action('admin_init', function(){
 if($GLOBALS['pagenow'] === 'options-reading.php' && !empty($_POST['submit']))
    // Clear the cache.
});

@jaswrks
Copy link

jaswrks commented Sep 21, 2014

Actually, it might be better like this...

<?php
add_action('admin_init', function(){
 if($GLOBALS['pagenow'] === 'options-reading.php' && !empty($_REQUEST['settings-updated']))
    // Clear the cache.
});

@raamdev
Copy link
Contributor Author

raamdev commented Sep 22, 2014

@jaswsinc That should work! Thank you.

@raamdev
Copy link
Contributor Author

raamdev commented Sep 23, 2014

Next release changelog:

  • Bug Fix: When changes are made to WordPress Reading Settings (Dashboard -> Settings -> Reading), Quick Cache now clears the cache to prevent an outdated cache file from being served to visitors. See #223.

@raamdev
Copy link
Contributor Author

raamdev commented Sep 25, 2014

Note: I updated this to include clearing the cache when General, Discussion, or Permalink settings are updated, as all of those have settings which could affect the frontend of the site and therefore cause cache files to become outdated.

@jaswrks
Copy link

jaswrks commented Sep 25, 2014

Cool 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants