我使用子目录创建了一个多站点。后端和前端的搜索功能仅在主站点上可用。如果我尝试在子目录中进行搜索,即使我知道页面/帖子存在,也会返回“未找到任何内容”。
在我的调试中。日志我看到:
[15-Nov-2018 17:40:18 UTC] WordPress database error Unknown column \'wp_posts.post_title\' in \'where clause\' for query SELECT wp_2_posts.ID, wp_2_posts.post_parent FROM wp_2_posts WHERE 1=1
AND (
(wp_posts.post_title LIKE \'%home%\')
OR (wp_posts.post_content LIKE \'%home%\')
OR EXISTS (
SELECT * FROM wp_postmeta
WHERE post_id = wp_posts.ID
AND ( (meta_key LIKE \'%title%\' AND meta_value LIKE \'%home%\') OR (meta_key LIKE \'%sub_title%\' AND meta_value LIKE \'%home%\') OR (meta_key LIKE \'%excerpt_short%\' AND meta_value LIKE \'%home%\') OR (meta_key LIKE \'%excerpt_long%\' AND meta_value LIKE \'%home%\') OR (meta_key LIKE \'%xyz%\' AND meta_value LIKE \'%home%\') OR (meta_key LIKE \'%myACF%\' AND meta_value LIKE \'%home%\') )
)
OR EXISTS (
SELECT * FROM wp_comments
WHERE comment_post_ID = wp_posts.ID
AND comment_content LIKE \'%home%\'
)
OR EXISTS (
SELECT * FROM wp_terms
INNER JOIN wp_term_taxonomy
ON wp_term_taxonomy.term_id = wp_terms.term_id
INNER JOIN wp_term_relationships
ON wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
WHERE (
taxonomy = \'post_tag\'
OR taxonomy = \'category\'
OR taxonomy = \'myCustomTax\'
)
AND object_id = wp_posts.ID
AND wp_terms.name LIKE \'%home%\'
)
) AND wp_2_posts.post_type = \'page\' AND (wp_2_posts.post_status = \'publish\' OR wp_2_posts.post_status = \'acf-disabled\' OR wp_2_posts.post_status = \'future\' OR wp_2_posts.post_status = \'draft\' OR wp_2_posts.post_status = \'pending\' OR wp_2_posts.post_status = \'private\') ORDER BY wp_2_posts.menu_order ASC, wp_2_posts.post_title ASC made by WP_Posts_List_Table->prepare_items, wp_edit_posts_query, wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, W3TC\\DbCache_Wpdb->query, W3TC\\DbCache_WpdbInjection_QueryCaching->query, W3TC\\_CallUnderlying->query, W3TC\\DbCache_Wpdb->query, W3TC\\DbCache_WpdbInjection->query, W3TC\\DbCache_Wpdb->default_query
[15-Nov-2018 17:40:18 UTC] WordPress database error Unknown column \'wp_posts.post_title\' in \'where clause\' for query SELECT wp_2_posts.ID, wp_2_posts.post_parent FROM wp_2_posts WHERE 1=1
AND (
(wp_posts.post_title LIKE \'%home%\')
OR (wp_posts.post_content LIKE \'%home%\')
OR EXISTS (
SELECT * FROM wp_postmeta
WHERE post_id = wp_posts.ID
AND ( (meta_key LIKE \'%title%\' AND meta_value LIKE \'%home%\') OR (meta_key LIKE \'%sub_title%\' AND meta_value LIKE \'%home%\') OR (meta_key LIKE \'%excerpt_short%\' AND meta_value LIKE \'%home%\') OR (meta_key LIKE \'%excerpt_long%\' AND meta_value LIKE \'%home%\') OR (meta_key LIKE \'%xyz%\' AND meta_value LIKE \'%home%\') OR (meta_key LIKE \'%myACF%\' AND meta_value LIKE \'%home%\') )
)
OR EXISTS (
SELECT * FROM wp_comments
WHERE comment_post_ID = wp_posts.ID
AND comment_content LIKE \'%home%\'
)
OR EXISTS (
SELECT * FROM wp_terms
INNER JOIN wp_term_taxonomy
ON wp_term_taxonomy.term_id = wp_terms.term_id
INNER JOIN wp_term_relationships
ON wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
WHERE (
taxonomy = \'post_tag\'
OR taxonomy = \'category\'
OR taxonomy = \'myCustomTax\'
)
AND object_id = wp_posts.ID
AND wp_terms.name LIKE \'%home%\'
)
) AND wp_2_posts.post_type = \'page\' AND (wp_2_posts.post_status = \'publish\' OR wp_2_posts.post_status = \'acf-disabled\' OR wp_2_posts.post_status = \'future\' OR wp_2_posts.post_status = \'draft\' OR wp_2_posts.post_status = \'pending\' OR wp_2_posts.post_status = \'private\') ORDER BY wp_2_posts.menu_order ASC, wp_2_posts.post_title ASC made by WP_List_Table->display, WP_List_Table->display_tablenav, WP_Posts_List_Table->extra_tablenav, do_action(\'manage_posts_extra_tablenav\'), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, WPSEO_Link_Columns->count_objects, WPSEO_Link_Columns->set_count_objects, WP_Query->get_posts, W3TC\\DbCache_Wpdb->query, W3TC\\DbCache_WpdbInjection_QueryCaching->query, W3TC\\_CallUnderlying->query, W3TC\\DbCache_Wpdb->query, W3TC\\DbCache_WpdbInjection->query, W3TC\\DbCache_Wpdb->default_query
我没有看到网站上其他地方出现错误
搜索表单代码:
<form action="<?php echo esc_url( home_url( \'/\' ) ); ?>" class="search-form">
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-12 search-container">
<input type="search" id="input-s" name="s" placeholder="Search For:" />
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 submit-btn-container">
<input type="submit" value="Search"/>
</div>
</form>