Title: SQL syntax error after WP &amp; NGG update
Last modified: April 23, 2025

---

# SQL syntax error after WP & NGG update

 *  Resolved [Gerdski](https://wordpress.org/support/users/gerdski/)
 * (@gerdski)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/sql-syntax-error-after-wp-ngg-update/)
 * Hello!
 * I just updated WP from 6.0.9 to 6.8 and NGG from 3.29 to 3.59.11. Since then 
   I receive many errors like this:
 *     ```wp-block-code
       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 'FROM wp_posts WHERE 1=1  AND ((wp_posts.post_type = 'post' AND (wp_pos...'at line 2 for query SELECT SQL_CALC_FOUND_ROWS  allFROM wp_posts WHERE 1=1  AND ((wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish'))) AND wp_posts.ID not in(149007) ORDER BY wp_posts.post_date DESCLIMIT 0, 30 made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/branfordmagazine-child/single.php'), related_posts, yarpp_related, YARPP->display_related, YARPP->get_template_content, include('/themes/branfordmagazine-child/yarpp-template-pex2.php'), get_the_excerpt, apply_filters('get_the_excerpt'), WP_Hook->apply_filters, wp_trim_excerpt, apply_filters('the_content'), WP_Hook->apply_filters, Imagely\NGG\IGW\ATPManager->substitute_placeholder_imgs, Imagely\NGG\DataMapper\DriverBase->find, Imagely\NGG\DataMapper\WPPostDriver->run_query, WP_Query->__construct, WP_Query->query, WP_Query->get_posts
       ```
   
 * I checked the files to be included, but there’s nothing wrong with them. The 
   references to Imagely\NGG led me to the suspicion that it has something to do
   with the NextGen Gallery Plugin.
 * How can I fix this error?
    -  This topic was modified 1 year, 1 month ago by [Gerdski](https://wordpress.org/support/users/gerdski/).

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

 *  [Barsha Paudel](https://wordpress.org/support/users/barsha05/)
 * (@barsha05)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/sql-syntax-error-after-wp-ngg-update/#post-18434302)
 * Hi [@gerdski](https://wordpress.org/support/users/gerdski/),
 * Thank you for reaching out,
 * We were aware of the issue, and it was resolved with the NextGEN Gallery version**
   3.59.11**. Updating to the latest version should have fixed the issue.
 * If the error is still appearing, I suggest you download a fresh copy of the latest
   NextGEN Gallery and, then replace the one from your site’s **Dashboard > Plugins
   > Add new plugin > Upload plugin > Choose File** (with the files’ override when
   being asked) to see if that’ll fix the issue?
 * Let me know the updates and I will get back to you.
 * Thanks!
 *  Thread Starter [Gerdski](https://wordpress.org/support/users/gerdski/)
 * (@gerdski)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/sql-syntax-error-after-wp-ngg-update/#post-18435168)
 * Hello,
 * thanks for your reply. I found a post by another user having the exact same error.
   I followed the instructions and installed 3.59.11 and it worked. Tried to post
   this here twice, but it didn’t work. Hope it works now.
 * Error is resolved 🙂 Thanks a lot!

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

The topic ‘SQL syntax error after WP & NGG update’ 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/)

 * 2 replies
 * 2 participants
 * Last reply from: [Gerdski](https://wordpress.org/support/users/gerdski/)
 * Last activity: [1 year, 1 month ago](https://wordpress.org/support/topic/sql-syntax-error-after-wp-ngg-update/#post-18435168)
 * Status: resolved