PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

SQL Error when searching products in Bear Bulk Editor

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hello Bear Bulk Editor Support,

I am encountering an SQL syntax error when trying to search products using Bear Bulk Editor within my WooCommerce store.

Here is the exact error message returned:
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 ')
ORDER BY wp_1971419420_posts.post_title ASC
LIMIT 0, 10' at line 3]

SELECT SQL_CALC_FOUND_ROWS wp_1971419420_posts.ID
FROM wp_1971419420_posts
WHERE 1=1 AND wp_1971419420_posts.post_type = 'product 'AND ((wp_1971419420_posts.post_status = 'publish 'OR wp_1971419420_posts.post_status = 'future 'OR wp_1971419420_posts.post_status = 'draft 'OR wp_1971419420_posts.post_status = 'pending 'OR wp_1971419420_posts.post_status = 'private ')) AND ( )
ORDER BY wp_1971419420_posts.post_title ASC
LIMIT 0, 10

Issue Analysis:

  • There seems to be an extra whitespace after 'product ' and after each post status ('publish ''draft ', etc.).
  • Additionally, there's an empty clause (AND ( )) causing the SQL syntax to fail.

Steps already tried:

  • Resetting all search filters within the Bear Bulk Editor interface.
  • Checking for conflicts with other plugins/themes.
  • Ensuring Bear Bulk Editor and WooCommerce are up-to-date.

Could you please investigate this issue and advise on a fix or workaround?

Thank you very much for your support,

I have temporarily corrected the problem as follows:

// Correctif pour l'erreur SQL de Bear Bulk Editor
add_filter('posts_where', 'fix_bear_bulk_editor_query', 999, 2);
function fix_bear_bulk_editor_query($where, $query) {
// Corriger les espaces en trop dans les valeurs
$where = preg_replace("/post_type\s*=\s*'([^']+)\s+'/","post_type = '$1'", $where);
$where = preg_replace("/post_status\s*=\s*'([^']+)\s+'/","post_status = '$1'", $where);

// Supprimer les clauses vides
$where = str_replace("AND ( )","", $where);

return $where;
}

Hello

Thank you for your cooperation!

What plugin version number are you using?

Hello, Version 2.1.4.5

Ok! We will fix this in the next version of the plugin.

Ok, thanks! Do you know when the next version would be available ?

Hello

Unfortunately I don't know the date, at the moment the list of tasks for the new version is being formed

Hello

Update is done, please do tests

Hi,

It seems to work, but I still have a problem. When I search and nothing matches, I shouldn't have all the products displayed.

Hello

Please describe this problem in more detail.

Hello,

Sorry for the late reply.

I have the latest version of the plugin installed, and when I search for something and nothing matches, there should be nothing in the list/displayed as nothing matching. Currently, it displays a list of all products.

https://share.cleanshot.com/nhZ4WqNg

Hello

Please try this( https://share.pluginus.net/image/i20250625115708.png ) -  https://bulk-editor.com/document/more-settings-implicit

Same as before

Please drop me wp-admin access - https://share.pluginus.net/image/i20230222134241.png ->https://share.pluginus.net/image/i20230222134615.png - I will check it

Done :)

Hello

Try in file - \wp-content\plugins\woo-bulk-editor\ext\filters\filters.php - please add this code - https://share.pluginus.net/image/i20250626121821.png

} else {
$sku_where .=" $wpdb->posts.ID IN(-1)";
}

Perfect thanks

Welcome;)