• Hello,

    I have a wordpress 3.5.2 site. All plugins have been upgraded to the latest version.

    When I go to any page or post I am getting the following error:
    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 ” at line 1 for query SELECT wpl_posts.* FROM wpl_posts INNER JOIN wpl_postmeta ON (wpl_posts.ID = wpl_postmeta.post_id) WHERE 1=1 AND wpl_posts.post_type = ‘attachment’ AND (wpl_posts.post_status = ‘inherit’) AND ( (wpl_postmeta.meta_key = ‘_wp_attachment_is_custom_header’ AND CAST(wpl_postmeta.meta_value AS CHAR) = ‘line49’) ) GROUP BY wpl_posts.ID ORDER BY wpl_posts.menu_order, made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/line49/page.php’), get_header, locate_template, load_template, require_once(‘/themes/line49/header.php’), get_header_image, get_random_header_image, _get_random_header_data, get_uploaded_header_images, get_posts, WP_Query->query, WP_Query->get_posts

    I am using a child theme of ‘the-bootstrap’. I tried removing all of the custom code from the child functions.php file, but still got the error. I did a database repair and that didn’t help either.

    Does anyone have any idea what would be causing this error?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Are you still having the issue? It looks like the error is either in one of the following 2 files:

    /themes/line49/page.php
    /themes/line49/header.php

    Thread Starter ljkeashly

    (@ljkeashly)

    Hi,

    Yes, I am still having the issue. The header.php and page.php files are the same as on 3 other sites that I have that don’t have the issue. The random image is not working on this site, but does on the others. If I choose one of the header images, it displays without an errors, but if I select random header images I get the sql error and no image.

    I tried to delete one of the random header images, but it won’t delete. I can upload new images, but not delete them once they are uploaded. I have to go to Media Library to delete the images. Don’t know if that could have anything to do with the problem.

    On this site, single.php is coming from the parent theme: the-bootstrap rather than using the single.php in the child theme: line49. That is another issue that I can’t figure out, why the child single.php is not overriding the parent single.php on this site. When you click into a single blog post, you get the parent the-bootstrap them being displayed instead of the child line49 theme being displayed.

    Thread Starter ljkeashly

    (@ljkeashly)

    Update, I found what was causing both issues. They were plugins that I had installed in the site. “Post Types Order” was causing the random image to stop working. “GYS Themed Categories” was causing the category to use the parent theme.

    Thank you for your help.

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

The topic ‘DB error on all pages & posts’ is closed to new replies.