Dear @webpemula ,
The error you’re encountering (Uncaught SyntaxError: "undefined" is not valid JSON
) usually occurs when JavaScript is attempting to parse something that isn’t a valid JSON format, and it’s likely caused by a conflict between your theme (Astra) or another plugin.
To resolve this issue by disabling the JavaScript for the filtering or sorting feature, you can follow this approach:
- Disable specific JavaScript for filtering/sorting: Instead of deactivating all JavaScript, you could deregister or dequeue the specific JavaScript file that handles sorting/filtering. You can do this in your
functions.php
file by identifying the script and using wp_dequeue_script()
or wp_deregister_script()
.
For your case, if you’re sure you don’t want the script loaded at all, you can use wp_deregister_script()
. However, if you just want to disable it for a particular instance but might need it later, go with wp_dequeue_script()
.
Example:
function remove_filter_js() {
wp_dequeue_script('tutor-filter-script'); // Replace 'tutor-filter-script' with the actual script handle.
}
add_action('wp_enqueue_scripts', 'remove_filter_js', 20);
After removing this script, the page will reload entirely when the user interacts with the filter or sorting menu.
- Temporarily disable conflicting plugins: If you believe the issue is due to a conflict with another plugin, try disabling plugins one by one to identify the conflicting one. You can then decide if you want to keep both or find alternatives.
Thank you for your patience, and I hope this resolves the issue.
Best regards,
Taufik Hasan