Title: WordPress 6.8 database error
Last modified: April 17, 2025

---

# WordPress 6.8 database error

 *  Resolved [david101design](https://wordpress.org/support/users/david101design/)
 * (@david101design)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/wordpress-6-8-database-error/)
 * version 3.59.10
 * Upgrading to WordPress 6.8 produces this 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 ‘FROM wp\_posts WHERE
   1=1 AND ((wp\_posts.post\_type = ‘post’ AND (wp\_pos…’ at line 2_
 * == Problem Query:
 * `**SELECT** SQL_CALC_FOUND_ROWS all
   **FROM** wp_posts**WHERE** 1=1**AND** ((wp_posts.
   post_type = 'post'**AND** (wp_posts.post_status = 'publish'**OR** wp_posts.post_status
   = 'acf-disabled'**OR** wp_posts.post_status = 'future'**OR** wp_posts.post_status
   = 'draft'**OR** wp_posts.post_status = 'pending'**OR** wp_posts.post_status ='
   private')))**ORDER** **BY** wp_posts.post_date **DESC****LIMIT** 0, 10
 * That ‘all’ in the query seems off.
 * == Stack trace:
    1. `WP_Query->get_posts()`
       wp-includes/class-wp-query.php:3429
    2. `WP_Query->query()`
       wp-includes/class-wp-query.php:3949
    3. `WP_Query->__construct()`
       wp-includes/class-wp-query.php:4081
    4. `Imagely\N\D\WPPostDriver->run_query()`
       wp-content/plugins/nextgen-gallery/src/
       DataMapper/WPPostDriver.php:418
    5. `Imagely\N\D\DriverBase->find_all()`
       wp-content/plugins/nextgen-gallery/src/
       DataMapper/DriverBase.php:174
    6. `M_Marketing->{closure}()`
       wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/
       modules/marketing/module.marketing.php:171
    7. `do_action('init')`
       wp-includes/plugin.php:517
 * Thanks.

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Thread Starter [david101design](https://wordpress.org/support/users/david101design/)
 * (@david101design)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/wordpress-6-8-database-error/#post-18420990)
 * This seems to work as a fix:
 * /wp-content/plugins/nextgen-gallery/src/DataMapper/WPPostDriver.php, alter line
   418:
 * $query = new \WP_Query( [ ‘datamapper’ => true**, ‘fields’ => ‘\*’ **] );
 *  [HAVOCA](https://wordpress.org/support/users/havoca/)
 * (@havoca)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/wordpress-6-8-database-error/#post-18422255)
 * Thanks for this, I’m having the same problem. I’ll update WPPostDriver.php and
   let you know if it fixes it for me too.
 *  [HAVOCA](https://wordpress.org/support/users/havoca/)
 * (@havoca)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/wordpress-6-8-database-error/#post-18422277)
 * Yes, thats fixed it for me too. Thank you [@david101design](https://wordpress.org/support/users/david101design/)
 *  [Carlos Carmona](https://wordpress.org/support/users/cecarmona/)
 * (@cecarmona)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/wordpress-6-8-database-error/#post-18422379)
 * Hi @david101design ,
 * Thanks for your patience while we looked into the issue.
 * It looks like there’s** **a bug affecting the SQL syntax!
 * A report has been created about this issue to notify our development team about
   it. I apologize for the inconvenience in the meantime. I can’t currently provide
   an ETA for when a fix will be released. However, I’m taking note of this thread
   and I’ll make sure to send you an update when an update that fixes this issue
   is released.
   **Temporary workaround:**
 * Thanks for suggesting the temporary solution. We truly appreciate you taking 
   the time to explore this issue and offer a solution for the NextGEN community.
 * Navigate to `/wp-content/plugins/nextgen-gallery/src/DataMapper/WPPostDriver.
   php` and alter line 418 to:
 *     ```wp-block-code
       $query = new \WP_Query( [ 'datamapper' => true, 'fields' => '*' ] );
       ```
   
 * Please let me know if you have any questions.
 * Thanks!
 *  [rakhesh123](https://wordpress.org/support/users/rakhesh123/)
 * (@rakhesh123)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/wordpress-6-8-database-error/#post-18422687)
 * same issue
 *  [Carlos Carmona](https://wordpress.org/support/users/cecarmona/)
 * (@cecarmona)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/wordpress-6-8-database-error/#post-18423116)
 * Hi, [@david101design](https://wordpress.org/support/users/david101design/) !
 * I just wanted to give you an update on the issue you reported earlier. Good news!
   Our team has addressed it in the latest release of NextGEN Gallery _v3.59.11_,
   so you should be good to go. 
 * To make sure everything is working smoothly, could you please update to the latest
   version of NextGEN and let us know if you’re still encountering any issues? We
   really appreciate your help in identifying this problem and your patience as 
   we worked to fix it. 
 * If you have any questions or need further assistance, don’t hesitate to reach
   out.
 *  [HAVOCA](https://wordpress.org/support/users/havoca/)
 * (@havoca)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/wordpress-6-8-database-error/#post-18423682)
 * That update works for me! Thank you [@cecarmona](https://wordpress.org/support/users/cecarmona/)
 *  Thread Starter [david101design](https://wordpress.org/support/users/david101design/)
 * (@david101design)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/wordpress-6-8-database-error/#post-18428461)
 * [@cecarmona](https://wordpress.org/support/users/cecarmona/) Updated now. All
   good so far. Thanks.
 *  [rebop](https://wordpress.org/support/users/rebop/)
 * (@rebop)
 * [11 months, 3 weeks ago](https://wordpress.org/support/topic/wordpress-6-8-database-error/#post-18512614)
 * Same issue.
 * I did upgrade to 3.59.12 and one error log seems to have stopped but this one
   in WP-ADMIN keeps growing:
 * 14-Jun-2025 19:22:30 UTC] WordPress database error You have an error in your 
   SQL syntax; check the manual that corresponds to your MySQL server version for
   the right syntax to use near ‘FROM wp_posts
   WHERE 1=1 AND ((wp_posts.post_type
   = ‘post’ AND (wp_posts.’ at line 2 for query SELECT SQL_CALC_FOUND_ROWS allFROM
   wp_postsWHERE 1=1 AND ((wp_posts.post_type = ‘post’ AND (wp_posts.post_status
   = ‘publish’ OR wp_posts.post_status = ‘future’ OR wp_posts.post_status = ‘draft’
   OR wp_posts.post_status = ‘pending’OR wp_posts.post_status = ‘private’)))
 *     ```wp-block-code
                        ORDER BY wp_posts.post_date DESC
                        LIMIT 0, 12 made by require_once('wp-admin/admin.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, M_Marketing->{closure}, Imagely\NGG\DataMapper\DriverBase->find_all, Imagely\NGG\DataMapper\WPPostDriver->run_query, WP_Query->__construct, WP_Query->query, WP_Query->get_posts
       ```
   
 * [14-Jun-2025 19:22:40 UTC] WordPress database error You have an error in your
   SQL syntax; check the manual that corresponds to your MySQL server version for
   the right syntax to use near ‘FROM wp_posts
   WHERE 1=1 AND ((wp_posts.post_type
   = ‘post’ AND (wp_posts.’ at line 2 for query SELECT SQL_CALC_FOUND_ROWS allFROM
   wp_postsWHERE 1=1 AND ((wp_posts.post_type = ‘post’ AND (wp_posts.post_status
   = ‘publish’ OR wp_posts.post_status = ‘future’ OR wp_posts.post_status = ‘draft’
   OR wp_posts.post_status = ‘pending’OR wp_posts.post_status = ‘private’)))
 *     ```wp-block-code
                        ORDER BY wp_posts.post_date DESC
                        LIMIT 0, 12 made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, M_Marketing->{closure}, Imagely\NGG\DataMapper\DriverBase->find_all, Imagely\NGG\DataMapper\WPPostDriver->run_query, WP_Query->__construct, WP_Query->query, WP_Query->get_posts
       ```
   
 * Thanks for the help!
 *  [rebop](https://wordpress.org/support/users/rebop/)
 * (@rebop)
 * [11 months, 3 weeks ago](https://wordpress.org/support/topic/wordpress-6-8-database-error/#post-18512618)
 * Actually, may have to take that back. I did check the mentioned php line 418 
   and it is correct. Since then, the error only occurred once and now seems to 
   have stopped building up. I’ll keep an eye on it.
 *  [costasd](https://wordpress.org/support/users/costasundog/)
 * (@costasundog)
 * [9 months ago](https://wordpress.org/support/topic/wordpress-6-8-database-error/#post-18626779)
 * Same issue on v3.59.12 except error is coming from a different file:
 * /wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/datamapper/
   package.module.datamapper.php:1529
 * It’s the same line of code and switching it to the “Temporary workaround” version
   fixed it. [https://wordpress.org/support/topic/wordpress-6-8-database-error/#post-18422379](https://wordpress.org/support/topic/wordpress-6-8-database-error/#post-18422379)

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘WordPress 6.8 database error’ is closed to new replies.

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

 * 11 replies
 * 6 participants
 * Last reply from: [costasd](https://wordpress.org/support/users/costasundog/)
 * Last activity: [9 months ago](https://wordpress.org/support/topic/wordpress-6-8-database-error/#post-18626779)
 * Status: resolved