• Resolved Preliot

    (@preliot)


    This issue was first posted at Matomo sql syntax error, but it seems the issue is not there. The plugin author directed me to the get_search_query() and the filter for it.

    In my install the only filters i found are created in the WooCommerce plugin (WC_Admin_List_Table_Products.php).

    The issue

    I’m seeing sql errors in my log file. Because it was unreadable, i’ve added whitespaces. Also replace my theme name with <theme>.

    [28-Apr-2022 23:39:44 UTC] WordPress databasefout You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near

    '))) AND ((wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' ...'

    at line 6 in query

    SELECT wp_posts.* 
    FROM wp_posts  
    LEFT JOIN wp_icl_translations wpml_translations
    ON wp_posts.ID = wpml_translations.element_id
    AND wpml_translations.element_type = CONCAT('post_', wp_posts.post_type)  WHERE 1=1  
    AND ((()))  
    AND ((wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) 
    OR (wp_posts.post_type = 'page' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) 
    OR (wp_posts.post_type = 'attachment' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) 
    OR (wp_posts.post_type = 'product' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) 
    OR (wp_posts.post_type = 'aiovg_videos' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) 
    OR (wp_posts.post_type = 'news' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) 
    OR (wp_posts.post_type = 'custom_type' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))) 
    AND (((wpml_translations.language_code = 'nl' OR 0 ) 
    AND wp_posts.post_type  IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','acf-field-group','product','product_variation','aiovg_videos','news' ))
    OR wp_posts.post_type  NOT  IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','acf-field-group','product','product_variation','aiovg_videos','news' ))
    
    ORDER BY wp_posts.post_date DESC
    gemaakt door 
    require('wp-blog-header.php'), 
    require_once('wp-includes/template-loader.php'), 
    include('/themes/<theme>/search.php'), 
    get_footer, 
    locate_template, 
    load_template, 
    require_once('/themes/<theme>/footer-without-newsletter.php'), 
    get_template_part, 
    locate_template, 
    load_template, 
    require('/themes/<theme>/partials/footer/footer-end.php'), 
    wp_footer, 
    do_action('wp_footer'), 
    WP_Hook->do_action, 
    WP_Hook->apply_filters, 
    WpMatomo\TrackingCode->add_javascript_code, 
    WpMatomo\TrackingCode\TrackingCodeGenerator->get_tracking_code, 
    WpMatomo\TrackingCode\TrackingCodeGenerator->apply_search_changes, 
    WP_Query->__construct, 
    WP_Query->query, 
    WP_Query->get_posts

    I assumed it had to do something with WpMatomo, because the issue originates there. But it turns out apply_search_changes() is calling the method get_search_query() which applies the filter get_search_query.

    So what is going on?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Daniyal Ahmed (a11n)

    (@daniyalahmedk)

    Hi there,

    Thanks for reaching out.

    Looks like the issue is coming from WPML instead, the above query is used by WPML to fetch the data (post, pages, etc.).

    I’ll recommend you disable WPML temporarily and see if you are able to reproduce any such issue. You can also reach out to WPML support for that, and see how it goes.

    I hope it helps!

    Best,

    We’ve not heard back from you, so I’m marking this thread as resolved. Hopefully, the above info was helpful.

    If you have other questions, please feel free to open a new topic.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘SQL syntax error in log’ is closed to new replies.