How to prevent a specific page to load with AJAX

Sometimes you might be in a situation where a certain page does not load the first time, or one of your pages is broken. (You must refresh the page to loads its content properly). In most cases, this issue is related to one of the third-party plugins you are using on the page which is not compatible with AJAX page loading. The plugin throws an error in the console and thus, breaks the ajax loading script.

The first step is to identify which plugin is causing the problem. To identify it, deactivate all your plugins except our own Sonaar plugins then see if the issue persists. If the page loads well when you visit it through AJAX, please reactivate your plugins one by one and see which plugin can cause the conflict.


1) If you really wish to use the plugin AND our AJAX page loading: You might have to contact the author of the plugin and check with them how can you re-init the plugin script via Javascript call. Then, you can add the JS function in WP-admin > Theme Options > Custom CSS / JS and add your code snippet in the Custom JS field.

The script rendered in this field is always called once the page has loaded, so you can reinit your custom js script there. If they cannot provide a re-init function, then you will have to check for other solution below:

2) If you really wish to use the plugin, but are ok to load this specific page in a standard way (like any other WordPress Theme would load): You can prevent a specific page from being loaded via AJAX by adding a specific CSS class on your menu items, or on the 'a href' tag that loads the problematic page. The CSS class to use is no-ajax

Example with an HTML link:

<a href="https://yourdomain.com/problematic-page/" class="no-ajax">My Link</a>

Example with a Menu Item:

If the page is loaded from your WordPress menu, then you can add a specific class to your menu item by going to WP-Admin > Appearance > Menu.

See screenshot https://d.pr/i/ZNbyx1

3) Disable AJAX for the whole website:

To turn off AJAX for the whole website, go to WP-Admin > Theme Options > General Settings and disable Continuous Audio Player & AJAX