• Resolved webpemula

    (@webpemula)


    i’ve got this message from sonsole when trying to set some filter or sorting in courses list menu

    Uncaught SyntaxError: “undefined” is not valid JSON

    but the url has changed after set some filter or sorting even though it’s not refreshing the page.

    can i just deactivate the js for this feature? so i just want to refreshing the page only. because it might be conflict with another plugin or theme.

    fyi i used astra theme

Viewing 1 replies (of 1 total)
  • 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:

    1. 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.

    1. 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

Viewing 1 replies (of 1 total)
  • The topic ‘Filter or sorting only loop’ is closed to new replies.