WordPress Long search string returns empty query vars and redirects to homepage
1.已经实现了Drupal搜索:posts_search过滤器。
好的。
1 2 3 4 5 6 7 8 9 10 11 | add_filter( 'posts_search', 'extend_search', 500, 2 ); function extend_search($search, &$wp_query) { error_log(json_encode($wp_query)); $terms = $wp_query->query_vars[ 's' ]; error_log(json_encode($terms)); . . . return $search } |
问题:当1搜索很长的文本时,将1重定向到主页。
好的。
即例如
好的。
1搜查,大红萝卜,改善生态环境。保留茉莉花的方便需求。茉莉花的质量。当立即拉射线超级碗山。直到比足球,小菜一碟,小孩子的足球,一口价,色拉。没有群众的秘方。直到脚下没有香蕉,牛肉功能齐全,物美价廉。实际上,justo,rhoncus ut,imperdiet a,venenatis vitae,justo。表示足球足球气脚软了气。整数开发人员。明天的蛋白质。如果不是总是活着的元素。不可扣除的区域。 Aenean leo ligula,porttitor eu,consequat vitae,eleifend ac,enim。在任何蛋白质进入Lorem之前,拉动一个feugiat mus。菜豆(Phasellus viverra nulla ut metus varius laoreet)。每次化妆。茉莉花的发型。即使是野蛮或宣传。聊天ullamcorper ultricies。对于功能值得。
好的。
结果首页网址:
https://my.test.com/~user/test/?s=Lorem+ipsum+dolor+sit+amet%2C+consectetuer+adipiscing+elit.+Aenean+commodo+ligula+eget+dolor.+Aenean+质量+有+盟友+感觉+房屋+和+大+推+赌注+山脉%2C + id +荒谬的+鼠标+预算+ I +燃气%2C +稀饭+普通%2C +孩子+足球%2C +价格+任何人2%+沙拉+否+摄影+质量+一个+一个+模型+脚+只是2C +生态+或%2C +香蕉+不含%2C +腐殖酸+网格%2C +酒精+周四+ I + 2%+ CNN + 2%+融资+ b%2C +绝育+生活2C +治疗+接力+ IT +天然气+欧盟+脚+软+价格+整数+开发人员+明天+蛋白质+生命+元素+总是+保存+ +艾尼安+伏尔泰人+日本+地球+艾尼安+狮子座+ ligula%2C +创新+ eu%2C +摄影+生活+ 2C +日本+和%2C +为您+ a + lorem ante%2C +蛋白质+ in%2C +卡通+任何人%2C + eu + b%2C +地区+ id + cartoon + no + as +恐惧+上市+ et。+每个+化妆品+茉莉+发型,小食+ + +,即使+或+宣传;聊天+ + + ullamcorper小食+ +对于+++需要值得。
好的。
并记录值;
好的。
wp_query:
{" query":[]," query_vars":{" error":"," m":"," p":0," post_parent":"," subpost":"," subpost_id":","附件":"," attachment_id":0,"名称":","静态":","页面名称":"," page_id":0,"第二":","分钟":","小时" :"," day":0," monthnum":0," year":0," w":0," category_name":"," tag":"," cat":11," tag_id":" ," author":"," author_name":"," feed":"," tb":","分页":0," comments_popup":"," meta_key":"," meta_value":"," Preview":"," s":","句子":"," title":"," fields":"," menu_order":"," category__in":[]," category__not_in":[]," category__and":[]," post__in":[]," post__not_in":[]," post_name__in":[]," tag__in":[]," tag__not_in":[]," tag__and":[]," tag_slug__in":[]," tag_slug__and":[]," post_parent__in":[]," post_parent__not_in":[]," author__in":[]," author__not_in":[]," ignore_sticky_posts":false," suppress_filters": false," cache_results":true," update_post_term_cache":true," update_post_meta_cache":true," post_type":"," posts_per_page":2," nopaging":false," comments_per_page":" 50"," no_found_rows": false}," tax_query":{" queries":[]," relation":" AND"," qu eried_terms":[]," primary_table":null," primary_id_column":null}," meta_query":{" queries":[]," relation":null," meta_table":null," meta_id_column":null," primary_table":null," primary_id_column":null}," date_query":false," post_count":0," current_post":-1," in_the_loop":false," comment_count":0," current_comment":-1," found_posts":0," max_num_pages":0," max_num_comment_pages":0," is_single":false," is_preview":false," is_page":false," is_archive":false," is_date":false," is_year":false," is_month":false," is_day":false," is_time":false," is_author":false," is_category":false," is_tag":false," is_tax":false," is_search": false," is_feed":false," is_comment_feed":false," is_trackback":false," is_home":true," is_404":false," is_embed":false," is_comments_popup":false," is_paged":false," is_admin":false," is_attachment":false," is_singular":false," is_robots":false," is_posts_page":false," is_post_type_archive":false," thumbnails_cached":false," updated_term_meta_cache":false," updated_comment_":假}
条款:"
搜索查询:
((((wp_posts.post_title)喜欢'%%')或(((wp_posts.post_content)喜欢'%%')))
所以,
对于长搜索字符串,查询变量为空,并且使用查询变量将我重定向到首页:
1 2 | is_home = true is_search = false |
有人可以帮忙解决这个问题吗?谢谢
好。
找到了解决方案...请参阅以下解决方案:_GET中的URL参数的最大大小
我使用以下命令检查了php配置:
1 2 3 |
并发现suhosin扩展变量的GET参数设置为512个字符:
1 | suhosin.get.max_value_length 512 |