Support » Plugin: WP-Optimize - Cache, Clean, Compress. » Exclude a Navigation from caching

  • Resolved mapdi

    (@mapdi)


    Hi there,

    Any chance to exclude Navigation(-elements) from caching?

    We enabled caching for logged-in users and after login they can’t see “logout” menu element in the navigation now.

    add_action('wp',
    	function() {
    		if (?? && !defined('DONOTCACHEPAGE')) {
    			define('DONOTCACHEPAGE', true);
    		}
    	}
    );
Viewing 4 replies - 1 through 4 (of 4 total)
  • A procedure for you to consider.
    The listing of elements to exclude in the wpo cache settings works really well.

    I did a preload first. Used ftp to look at the wpo cache folder for those sub-items I did not want cached (mostly menus).

    Then I listed the menu main link (header link) with the wild card as shown in the example. To cover all the bases I also listed the menu element links separately. As well as any other misc pages showing in the wp cache folder that I did not want cached.

    Saved the settings to exclude. Purged the cache and preloaded again. Had to do this process a couple of times to get all the exclude items listed. The final preload put only those pages I wanted into the wpo cache.

    I DID NOT check show cached pages to logged in users because the info popup says not to use if you have restricted content. In my case the login was only to use member restricted menus. But if you got only the non restricted stuff in the wpo cache, it would seem checking this option would not bother any of the memebers menu items as you experienced.

    I also use autoptimize with the wpo cache to handle the javascript, css and other optimizing stuff. Have achieved half millisecond load times on some pages this way.

    Hope this helps someone.

    • This reply was modified 1 year, 8 months ago by flyfisher842.
    • This reply was modified 1 year, 8 months ago by flyfisher842.

    I am interested in some of your comments. Namely:

    >> Used ftp to look at the wpo cache folder for those sub-items I did not want cached (mostly menus).

    When you say you didn’t want to cache menus. What did you mean by this exactly?

    >> Then I listed the menu main link (header link) with the wild card as shown in the example.

    When you say menu main link(header link) what you mean?

    >> To cover all the bases I also listed the menu element links separately.

    Are you saying you can specifically exclude menus/navigation bar elements from the cache?

    As I’m having big problems with a woocommerce site, whereby we preload and it gets purged within a few hours but we don’t know why and we’re not really getting any answers on here either. I think maybe it’s when a product is added. but I don’t see why that would purge the entire cache.

    I’ve turned on logging now so as I hopefully it will log when the cache is purged and perhaps say why also.

    Thanks,
    Chris

    Plugin Support Harshad

    (@bornforphp)

    @flyfisher842 Thanks for sharing the information.

    Plugin Support Marc Lacroix

    (@marcusig)

    Hi @mapdi

    If you’re asking if the menu bar (html) or other parts of the page can be excluded from the cache, it’s not possible. The whole page is cached to allow maximum performance.

    Not caching the menu or something else would require reduce the point of page caching considerably, as the full WordPress would have to be loaded.

    If you want to exclude a certain page only for logged in users, you would have to create a custom cache extension, but that would require a little bit of custom development (See https://getwpo.com/documentation/#Extending-the-page-cache).

    Marc.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Exclude a Navigation from caching’ is closed to new replies.