• I have a site that occasionally records this error to debug.log:

    [11-Jan-2022 07:52:12 UTC] WordPress database error Unknown column 'wp_posts.IDwp_posts.ID' in 'group statement' for query SELECT   wp_posts.* FROM wp_posts  INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1  AND wp_posts.post_name IN ('search') AND ( 
      0 = 1
    ) AND wp_posts.post_type = 'wp_template' AND ((wp_posts.post_status = 'publish')) GROUP BY wp_posts.IDwp_posts.ID ORDER BY wp_posts.post_date DESC  made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), get_search_template, get_query_template, locate_block_template, resolve_block_template, get_block_templates, WP_Query->__construct, WP_Query->query, WP_Query->get_posts

    There is no context given. I don’t know what was being attempted when the error occurred, so I am at a loss to reproduce and debug it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi, @jondhill:

    That query appears to be requesting a block template named “search”. From the clause: AND wp_posts.post_name IN ('search').

    When you review previous logs of this error, is this filter term consistent? Have you created custom block templates, or are you using a plugin that does so?

    Thread Starter jondhill

    (@jondhill)

    Thank you @ironprogrammer. The site doesn’t have navigation to local search, but I tested a url ending with ?s=test and it reproduced the error, thank you very much. Disabling Yoast Local eliminates the problem, so I will get with them next. I also need to implement a UI for getting to local search.

    Thread Starter jondhill

    (@jondhill)

    For the record, Yoast has confirmed that this database error is a result of a bug in Yoast Local that they may address at some time in the future.

    Workaround
    Disable the “Enhanced search” feature (SEO > Local SEO > Advanced settings).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do I get the context for a database error?’ is closed to new replies.