Title: Change cache time
Last modified: August 30, 2016

---

# Change cache time

 *  [betagoo](https://wordpress.org/support/users/betagoo/)
 * (@betagoo)
 * [11 years ago](https://wordpress.org/support/topic/change-cache-time/)
 * Can you write example code how to change cache time?
 * [https://wordpress.org/plugins/menu-cache/](https://wordpress.org/plugins/menu-cache/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [betagoo](https://wordpress.org/support/users/betagoo/)
 * (@betagoo)
 * [11 years ago](https://wordpress.org/support/topic/change-cache-time/#post-6201855)
 * Solution.
 *     ```
       function fnc_Menu_Cache()
       {
       	class Menu_Cache_Extender extends Menu_Cache
       	{
       		function __construct()
       		{
       			$this->cache_time = DAY_IN_SECONDS;
   
       			add_filter( 'wp_nav_menu',                                        array( $this, 'set_cached_menu' ), 10, 2 );
       			add_filter( 'pre_wp_nav_menu',                                    array( $this, 'get_cached_menu' ), 10, 2 );
       			add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'purge_admin_link' ) );
       			add_action( 'wp_update_nav_menu',                                 array( $this, 'refresh_cache' ) );
       			add_action( 'admin_init',                                         array( $this, 'purge_cache' ) );
       			add_action( 'plugins_loaded',                                     array( $this, 'localization' ) );
   
       		}
       	}
       	new Menu_Cache_Extender();
       }
       add_action( 'init', 'fnc_Menu_Cache');
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Change cache time’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/menu-cache.svg)
 * [Menu Cache](https://wordpress.org/plugins/menu-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/menu-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/menu-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/menu-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/menu-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/menu-cache/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [betagoo](https://wordpress.org/support/users/betagoo/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/change-cache-time/#post-6201855)
 * Status: not resolved