Making WordPress.org


Ignore:
Timestamp:
02/06/2014 05:06:08 PM (11 years ago)
Author:
iandunn
Message:

Coming Soon: Clear the static page cache when updating settings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/classes/wccsp-settings.php

    r381 r382  
    99     */
    1010    public function __construct() {
    11         add_action( 'admin_menu',            array( $this, 'register_settings_pages' ) );
    12         add_action( 'init',                  array( $this, 'init' ) );
    13         add_action( 'admin_init',            array( $this, 'register_settings' ) );
    14         add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
    15         add_action( 'admin_notices',         array( $this, 'render_admin_notices' ) );
     11        add_action( 'admin_menu',                   array( $this, 'register_settings_pages' ) );
     12        add_action( 'init',                         array( $this, 'init' ) );
     13        add_action( 'admin_init',                   array( $this, 'register_settings' ) );
     14        add_action( 'admin_enqueue_scripts',        array( $this, 'enqueue_scripts' ) );
     15        add_action( 'admin_notices',                array( $this, 'render_admin_notices' ) );
     16        add_action( 'update_option_wccsp_settings', array( $this, 'clear_static_page_cache' ) );
    1617    }
    1718
     
    203204
    204205    /**
     206     * Clear the static page cache
     207     * Changing the settings will change the how the page looks, so the cache needs to be refreshed.
     208     */
     209    public function clear_static_page_cache() {
     210        if ( function_exists( 'wp_cache_clear_cache' ) ) {
     211            wp_cache_clear_cache();
     212        }
     213    }
     214
     215    /**
    205216     * Renders notices for the administrator when problems are detected
    206217     */
Note: See TracChangeset for help on using the changeset viewer.