wordpress插件数据库错误您的sql语法有错误

icomxhvb  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(307)

每次加载一个页面时,我都会多次收到此消息[2018年7月7日17:30:49 utc]wordpress数据库错误您的sql语法有错误;请查看与您的mysql服务器版本对应的手册,以了解在第6行使用near'和p.post\u status='publish''的正确语法,以便从wp\u posts p查询选择count(*)

[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

我想这会导致geomashup的“geomashupdb.php”的一部分(复制到下面),我读了一些关于id/id之间大小写不匹配的内容,但是我似乎找不到任何这样的例子。任何帮助或建议都会很好。


* 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 );
}
qgzx9mmu

qgzx9mmu1#

一篇老文章,但值得一提的是:问题在于geomashup的widget选项“自动”为类别创建一个Map链接(admin>“模糊设置”)。
所有类别的所有职位都必须有 GeoMeta 已保存( la t, lng , geo-address ,和保存的名称),否则您将经常遇到此错误。
取消选中 Add map links to category lists 将停止错误。
通过名称/idMap类别的shortcode和template标记仍然可以正常工作。
希望这能帮到别人。

相关问题