此问题的出现是因为几个问题:
(1)WP_List_Table::search_box() 插入默认值_wpnonce 和_wp_http_referer 使用字段wp_nonce_field() 没有给你覆盖和说“我已经去了一个暂时的领域谢谢”的能力。
2) 您需要使用GET 作为子类化时表单提交的方法WP_List_Table 因为WP_List_Table::print_column_headers() 仅限支票$_GET 对于当前orderby 和order 参数和用途$_SERVER[\'REQUEST_URI\'] 用于构造其标头链接。如果您不使用GET 作为form方法,在对列进行排序时,将释放search参数。
有几种方法可以阻止Request-URI Too Large The requested URL\'s length exceeds the capacity limit for this server 错误:
A) 因为所有nonce检查函数都可以使用_wp_http_referer 请求字段或回退到推荐人的相应标头,您可以删除_wp_http_referer 在处理的早期查询参数。
因此,解决此问题的一个简单方法是在prepare_items() 您的功能WP_List_Table 子类。
$_SERVER[\'REQUEST_URI\'] = remove_query_arg( \'_wp_http_referer\', $_SERVER[\'REQUEST_URI\'] );
B) 可以说更好、更安全的方法是切换到
POST 表单提交方法和更新
$_SERVER[\'REQUEST_URI\'] 在里面
prepare_items() 一旦编译了所有您关心的参数
WP_List_Table::print_column_headers() 按预期运行。
$options = array(
\'blog_id\' => $blog_id,
\'s\' => $search,
\'record_type\' => $record_type,
\'orderby\' => $orderby,
\'order\' => $order,
);
// Update the current URI with the new options.
$_SERVER[\'REQUEST_URI\'] = add_query_arg( $options, $_SERVER[\'REQUEST_URI\'] );