Background of the issue:
I am trying to get rid of a repeating error in my error log related to WPML. The error is occurring on my site hidden link. The error message is: WordPress database error 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 icl_t.language_code = 'ar' GROUP BY terms.term_id' at line 10 for query SELECT COUNT( DISTINCT wp_posts.ID ) as term_count, terms.term_id as term_count_id FROM wp_posts INNER JOIN wp_term_relationships AS term_relationships ON wp_posts.ID = term_relationships.object_id INNER JOIN wp_term_taxonomy AS term_taxonomy USING( term_taxonomy_id ) INNER JOIN wp_terms AS terms USING( term_id ) INNER JOIN wp_icl_translations AS icl_t ON wp_posts.ID = icl_t.element_id AND icl_t.element_type = 'post_product' WHERE wp_posts.post_type IN ( 'product' ) AND wp_posts.post_status = 'publish' AND terms.term_id IN () AND icl_t.language_code = 'ar' GROUP BY terms.term_id made by require('wp-blog-header.php'), wp, WP->main, WP->parse_request, do_action_ref_array('parse_request'), WP_Hook->do_action, WP_Hook->apply_filters, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, WP_REST_Server->respond_to_request, WC_REST_Product_Attributes_V1_Controller->get_items, WC_REST_Product_Attributes_V1_Controller->prepare_item_for_response, apply_filters('woocommerce_rest_prepare_product_attribute'), WP_Hook->apply_filters, flutter_custom_change_product_attribute, get_filtered_term_product_counts.
Symptoms:
I am getting a WordPress database error related to SQL syntax in my error log.
Questions:
How can I fix the SQL syntax error related to WPML?
Is there a specific configuration in WPML that I need to check to resolve this error?
2. Go to WPML -> Support -> Troubleshooting (link)
3. Once on the troubleshooting screen, press the following buttons and check if it helps. Press each button at a time and wait for the process to complete.
- 'Disable cache for language switcher templates'
- 'Clear language information and repopulate languages' button (if it is showing)
- 'Synchronize posts taxonomies' for 'Products'
- 'Clear the cache in WPML'
- 'Remove ghost entries from the translation tables'
- 'Fix element_type collation'
- 'Fix WPML tables collation'
- 'Synchronize local job ids with ATE jobs'
- 'Synchronize translators and translation managers with ATE'
- 'Assign translation status to duplicated content'
- 'Set language information'
- 'Reset languages' Press this button only if you didn't add a custom language!
- 'Fix terms count'
- 'Fix post type assignment for translations'
- 'Cleanup and optimize string tables'
- 'Clear invalid strings'
*** Please backup your database before using this.***
Please try my suggestion. Meanwhile, I'm also consulting our second-tier supporters.
In addition to the above, here are further findings.
We have found that the SQL error occurs when the statement AND terms.term_id IN () is used. The IN clause cannot be empty—at least one ID must be provided.
Additionally, there is a method near the end of the call stack, flutter_custom_change_product_attribute, which we do not recognize and cannot locate through external sources. It would be helpful to gather more information from you regarding the origin of this method.
Regards,
Itamar.
The topic ‘[Closed] I’m getting an error in my error log and it’s related to WPML’ is closed to new replies.