dtby67541 2018-07-07 22:03
浏览 60

WordPress插件数据库错误您的SQL语法中有错误

I receive this multiple times each time a page loads. [07-Jul-2018 17:30:49 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 'AND p.post_status='publish'' at line 6 for query SELECT count(*) FROM wp_posts p

    [07-Jul-2018 17:30:49 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 'AND p.post_status='publish'' at line 6 for query SELECT count(*) FROM wp_posts p
INNER JOIN wp_term_relationships tr ON tr.object_id = p.ID
INNER JOIN wp_term_taxonomy tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
INNER JOIN wp_geo_mashup_location_relationships gmlr ON gmlr.object_id = p.ID AND gmlr.object_name = 'post'
WHERE tt.term_id =
AND p.post_status='publish' made by require('wp-blog-header.php'),
require_once('wp-includes/template-loader.php'),
include('/themes/hestia-child/front-page.php'),
get_footer, locate_template, load_template,
require_once('/themes/hestia-child/footer.php'),
do_action('hestia_do_footer_child'),
WP_Hook->do_action, WP_Hook->apply_filters,
call_user_func_array, hestia_the_footer_content_child,
dynamic_sidebar, call_user_func_array, WP_Widget->display_callback,
WP_Widget_Categories->widget, wp_dropdown_categories,
walk_category_dropdown_tree, call_user_func_array, Walker->walk, Walker->display_element,
call_user_func_array, Walker_CategoryDropdown->start_el, apply_filters('list_cats'),
WP_Hook->apply_filters, call_user_func_array, GeoMashup::list_cats, GeoMashupDB::category_located_post_count

I think it leads to a section of GeoMashup's "geo-mashup-db.php" (copied below) and I've read some things about upper/lower case mismatches between ID/id that can cause this, but I can't seem to find any instances of that. Any help or suggestions would be great.

* Get the number of located posts in a category.
*
* @since 1.2
*
* @param id $category_id
* @return int
*/
public static function category_located_post_count( $category_id ) {
global $wpdb;

$select_string = "SELECT count(*) FROM {$wpdb->posts} p
INNER JOIN {$wpdb->term_relationships} tr ON tr.object_id = p.ID
INNER JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
INNER JOIN {$wpdb->prefix}geo_mashup_location_relationships gmlr ON gmlr.object_id = p.ID AND gmlr.object_name = 'post'
WHERE tt.term_id = " . esc_sql( $category_id ) ."
AND p.post_status='publish'";
return $wpdb->get_var( $select_string );
}

/**
* Get categories that contain located objects.
*
* Not sufficient - probably want parent categories.
*
* @return array Located category id, name, slug, description, and parent id
*/
private static function get_located_categories() {
global $wpdb;

$select_string = "SELECT DISTINCT t.term_id, t.name, t.slug, tt.description, tt.parent
FROM {$wpdb->prefix}geo_mashup_location_relationships gmlr
INNER JOIN {$wpdb->term_relationships} tr ON tr.object_id = gmlr.object_id
INNER JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
INNER JOIN {$wpdb->terms} t ON t.term_id = tt.term_id
WHERE tt.taxonomy='category'
ORDER BY t.slug ASC";
return $wpdb->get_results( $select_string );
}
  • 写回答

1条回答 默认 最新

  • douzhun4124 2018-11-26 19:06
    关注

    An older post, but for what it's worth: the issue is with Geo Mashup's widget option that "automatically" creates a map link for categories (admin > "obscure settings").

    ALL posts in ALL categories must have ALL GeoMeta saved (lat, lng, geo-address, and saved name) or you'll get this error a lot.

    Unchecking Add map links to category lists will stop the errors.
    The shortcodes & template tags to map a category by name/ID will still work fine.

    Hope this can help someone.

    评论

报告相同问题?

悬赏问题

  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程