Title: Exclude Navigation Menu
Last modified: August 5, 2020

---

# Exclude Navigation Menu

 *  Resolved [davidovic123](https://wordpress.org/support/users/davidovic123/)
 * (@davidovic123)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/exclude-navigation-menu/)
 * Hello everyone,
 * Please, I need to exclude only the navigation menu from to be cached.
 * How to do so?
 * Thank You.

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/exclude-navigation-menu/#post-13212990)
 * Hello [@davidovic123](https://wordpress.org/support/users/davidovic123/)
 * Thank you for your inquiry and I am happy to assist you with this.
    Can you please
   share some more information and details about what you are trying to achieve 
   and also what kind of issues you are experiencing? It would also be helpful if
   you’d share your website URL. Thanks!
 *  Thread Starter [davidovic123](https://wordpress.org/support/users/davidovic123/)
 * (@davidovic123)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/exclude-navigation-menu/#post-13214439)
 * Hello [@vmarko](https://wordpress.org/support/users/vmarko/)
 * The website is under development in the local environment right now.
 * In fact, I added a Login/Logout Link to the main navigation menu.
 * But there is one issue:
 * When I Log In, the word & the link on the menu should say Log Out. In fact, the
   Log Out shows correctly.
 * When I browse the pages, the word displayed still the same in the same stand.
   But when I go to some other pages the word on the menu switches to Log In, when
   I’m already Logged In.
 * If I click on this Log In, It brings me to “my account” ‘s dashboard, because
   I’m already Logged In. It does not bring me to Login Form.
 * The word displayed on menu changes from “Log Out” to “Log In” for some pages.
 * The “Log Out” link works well on pages, but for some of them the word “Log Out”
   switches to “Log In”!!
 * ===
 * If I force a hard reload, the correct word appears on the menu again.
 * Also, when I disabled W3TC for testing, Login pages are not cached, and then 
   it works. No changes are mentioned in the Login/logout menu appearance.
 * Notice that In W3TC the Login pages are already not cached by default: “Don’t
   cache pages for logged in users” feature is enabled.
 * Beneath that feature, there is another feature for “users roles”. Admin, Author,
   Contributor are enabled to not be cached by default.
    I added all other users,
   such as subscribers, to be not cached.
 * I tested again and the previous behavior is coming back despite the “no caching”
   enabled for All users.
 * ===
 * That’s why I ask if I can disable the Menu from to be cached in order to avoid
   this behavior for Login/logout on the Menu?
 * Thank You.
    -  This reply was modified 5 years, 9 months ago by [davidovic123](https://wordpress.org/support/users/davidovic123/).
    -  This reply was modified 5 years, 9 months ago by [davidovic123](https://wordpress.org/support/users/davidovic123/).
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/exclude-navigation-menu/#post-13216422)
 * Hello [@davidovic123](https://wordpress.org/support/users/davidovic123/)
 * Thank you for the detailed explanation.
    Can you please also share the browser
   cache settings for HTML&XML? Try disabling expires header in Performance>Browser
   Cache>HTML&XML, save all settings and purge the cache and see if the issue persists.
   Thanks!
 *  Thread Starter [davidovic123](https://wordpress.org/support/users/davidovic123/)
 * (@davidovic123)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/exclude-navigation-menu/#post-13218477)
 * Hello [@vmarko](https://wordpress.org/support/users/vmarko/),
 * I disabled “set expires header” in Performance>Browser Cache>HTML&XML saved all
   settings and purged the cache. The behavior of the login/logout on the menu still
   as it was.
 * Also, I redid the test by deactivating the W3TC plugin, contrary to what I noticed
   yesterday, the issue persists.
 * Probably it’s another reason which causes this interference. maybe not the W3TC.
 * I will consider other solutions for the setting I need to implement.
 * Thank you for your support. I apologize for this inconvenience.
 * Have a nice day.
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/exclude-navigation-menu/#post-13220910)
 * Hello [@davidovic123](https://wordpress.org/support/users/davidovic123/)
    Thank
   you for the information. If the issue persist when W3 Total Cache is disabled
   then the issue is not related to W3 Total Cache. There is one thing that you 
   can also do with W3 Total Cache and that’s to use Page Fragment Caching. meaning,
   wrap the part of the PHP code with `<!-- mfunc -->` which will ensure that the
   dynamic part of the page is not cached. Please check our [FAQ](https://github.com/W3EDGE/w3-total-cache/wiki/FAQ:-Developers#what-is-page-fragment-cache)
   for more details about this. Using ajax call for this may also help. Thank you!
 *  Thread Starter [davidovic123](https://wordpress.org/support/users/davidovic123/)
 * (@davidovic123)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/exclude-navigation-menu/#post-13226478)
 * Hello [@vmarko](https://wordpress.org/support/users/vmarko/),
 * I followed these steps:
 * 1. used Page Cache mode Disk: Basic
    2. enabled Late initialization: in the Page
   Cache settings. 3. defined a static variable in wp-config.php file: `define( '
   W3TC_DYNAMIC_SECURITY', 'mysecurestring' );` 4. Minify setting is not enabled,
   so I didn’t add `mfunc` and `mclude` == 5. I wrapped a piece of code in functions.
   php file like so:
 *     ```
       <!-- mclude mysecurestring -->
       (code here)
       <!-- /mclude mysecurestring -->
       ```
   
 * ==
 * Unfortunately, I got a message error in my cPanel interface says:
    syntax error,
   unexpected ‘<‘
 * The website didn’t open displaying this message:
    There has been a critical error
   on your website. Learn more about debugging in WordPress.
 * Thank you.
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/exclude-navigation-menu/#post-13233141)
 * Hello [@davidovic123](https://wordpress.org/support/users/davidovic123/)
 * You’ve added the PHP code using mclude. Try using mfunc as suggested in the FAQ:
 *     ```
       <!-- mfunc mysecurestring -->
       (code here)
       <!-- /mfunc mysecurestring -->
       ```
   
 * Thanks!
 *  Thread Starter [davidovic123](https://wordpress.org/support/users/davidovic123/)
 * (@davidovic123)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/exclude-navigation-menu/#post-13244344)
 * Hello [@vmarko](https://wordpress.org/support/users/vmarko/),
 * Sorry, in fact I used `<!-- mfunc -->` instead of `<!-- mclude -->`.
    And I got
   a syntax message error!
 * `syntax error, unexpected ‘<‘`
 * Thanks.
 *  [tonyclemmey](https://wordpress.org/support/users/tonyclemmey/)
 * (@tonyclemmey)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/exclude-navigation-menu/#post-13919533)
 * Hello,
 * I am having the same issue as [@davidovic123](https://wordpress.org/support/users/davidovic123/)
   with “Parse error: syntax error, unexpected ‘<‘, ”
 * I also created an issue on Github for this [https://github.com/W3EDGE/w3-total-cache/issues/322](https://github.com/W3EDGE/w3-total-cache/issues/322)
 * Did anyone resolve this?
 *  Plugin Author [Joe Cartonia](https://wordpress.org/support/users/joemoto/)
 * (@joemoto)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/exclude-navigation-menu/#post-13924426)
 * If anyone is seeing a parse error, then please ensure that your code block is
   added in an HTML section of your theme template file; not inside of the PHP tags.
 * I just updated our wiki FAQ page [https://github.com/W3EDGE/w3-total-cache/wiki/FAQ:-Developers#what-is-page-fragment-cache](https://github.com/W3EDGE/w3-total-cache/wiki/FAQ:-Developers#what-is-page-fragment-cache)
   with more information on the feature.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Exclude Navigation Menu’ is closed to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

## Tags

 * [exclude](https://wordpress.org/support/topic-tag/exclude/)
 * [menu](https://wordpress.org/support/topic-tag/menu/)

 * 10 replies
 * 4 participants
 * Last reply from: [Joe Cartonia](https://wordpress.org/support/users/joemoto/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/exclude-navigation-menu/#post-13924426)
 * Status: resolved