搜索所有插件集成

时间:2012-06-09 作者:Siddharth

我的wordpress网站上的搜索结果是404。当我点击搜索按钮时,它试图在不存在wordpress/wordpress/index的路径中打开一个php文件。php。我不知道这是如何配置的,也不知道在哪里重置搜索按钮操作代码。

我认为安装“搜索一切插件”可以解决我的搜索问题,它做到了。这项测试做得很好。但我需要找出如何解决搜索按钮的问题。

我刚开始使用wordpress,不懂php。

编辑:我刚刚为我的主页做了一个“查看源”并找到

<form id="searchform" class="searchform" method="get" action="http://localhost/wordpress/wordpress/index.php">
我还做了一个

sudo grep -r "searchForm" .
找到我所有痛苦的根源,

./wp-content/themes/graphene/searchform.php:<form id="searchform" class="searchform" method="get" action="<?php echo get_home_url(), $_SERVER[\'PHP_SELF\']; ?>">
似乎url是从PHP-SELF获取其值的

所以我搜索PHP-SELF的价值来源

sudo grep --exclude-dir=.svn -r "SERVER\\[\'PHP_SELF\'\\] = " .
./wp-includes/load.php:     $_SERVER[\'PHP_SELF\'] = $PHP_SELF = preg_replace( \'/(\\?.*)?$/\', \'\', $_SERVER["REQUEST_URI"] );
./wp-login.php:     $_SERVER[\'PHP_SELF\'] = str_replace( $_SERVER[\'PATH_INFO\'], \'\', $_SERVER[\'PHP_SELF\'] );
现在,似乎使用REQUEST\\u URI初始化PHP\\u SELFORIts PATH\\u INFO和PHP\\u SELF

随着我进一步挖掘,它变得越来越复杂。我的问题是,What is expected to be the value of PHP_SELF.

sudo grep --exclude-dir=.svn -r "SERVER\\[\'REQUEST_URI\'\\] = " .
./wp-includes/load.php:         $_SERVER[\'REQUEST_URI\'] = $_SERVER[\'HTTP_X_ORIGINAL_URL\'];
./wp-includes/load.php:         $_SERVER[\'REQUEST_URI\'] = $_SERVER[\'HTTP_X_REWRITE_URL\'];
./wp-includes/load.php:                 $_SERVER[\'REQUEST_URI\'] = $_SERVER[\'PATH_INFO\'];
./wp-includes/load.php:                 $_SERVER[\'REQUEST_URI\'] = $_SERVER[\'SCRIPT_NAME\'] . $_SERVER[\'PATH_INFO\'];
./wp-admin/link-manager.php:    $_SERVER[\'REQUEST_URI\'] = remove_query_arg(array(\'deleted\'), $_SERVER[\'REQUEST_URI\']);
./wp-admin/upload.php:  $_SERVER[\'REQUEST_URI\'] = remove_query_arg(array(\'posted\'), $_SERVER[\'REQUEST_URI\']);
./wp-admin/upload.php:  $_SERVER[\'REQUEST_URI\'] = remove_query_arg(array(\'attached\'), $_SERVER[\'REQUEST_URI\']);
./wp-admin/upload.php:  $_SERVER[\'REQUEST_URI\'] = remove_query_arg(array(\'deleted\'), $_SERVER[\'REQUEST_URI\']);
./wp-admin/upload.php:  $_SERVER[\'REQUEST_URI\'] = remove_query_arg(array(\'trashed\'), $_SERVER[\'REQUEST_URI\']);
./wp-admin/upload.php:  $_SERVER[\'REQUEST_URI\'] = remove_query_arg(array(\'untrashed\'), $_SERVER[\'REQUEST_URI\']);
./wp-admin/upload.php:  $_SERVER[\'REQUEST_URI\'] = remove_query_arg(array(\'message\'), $_SERVER[\'REQUEST_URI\']);
./wp-admin/plugins.php:$_SERVER[\'REQUEST_URI\'] = remove_query_arg(array(\'error\', \'deleted\', \'activate\', \'activate-multi\', \'deactivate\', \'deactivate-multi\', \'_error_nonce\'), $_SERVER[\'REQUEST_URI\']);
./wp-admin/edit-tags.php:<?php $_SERVER[\'REQUEST_URI\'] = remove_query_arg(array(\'message\'), $_SERVER[\'REQUEST_URI\']);
./wp-admin/network/themes.php:$_SERVER[\'REQUEST_URI\'] = remove_query_arg( $temp_args, $_SERVER[\'REQUEST_URI\'] );
./wp-admin/network/site-users.php:$_SERVER[\'REQUEST_URI\'] = remove_query_arg( \'update\', $_SERVER[\'REQUEST_URI\'] );
./wp-admin/network/site-themes.php:$_SERVER[\'REQUEST_URI\'] = remove_query_arg( $temp_args, $_SERVER[\'REQUEST_URI\'] );
./wp-admin/includes/class-wp-plugins-list-table.php:            $_SERVER[\'REQUEST_URI\'] = add_query_arg(\'s\', stripslashes($_REQUEST[\'s\']) );
./wp-admin/edit.php:$_SERVER[\'REQUEST_URI\'] = remove_query_arg( array(\'locked\', \'skipped\', \'updated\', \'deleted\', \'trashed\', \'untrashed\'), $_SERVER[\'REQUEST_URI\'] );
./wp-content/plugins/w3-total-cache/lib/W3/PgCacheFlush.php:        $_SERVER[\'REQUEST_URI\'] = $url;
./wp-content/plugins/w3-total-cache/lib/W3/PgCacheFlush.php:        $_SERVER[\'REQUEST_URI\'] = $request_uri;

1 个回复
最合适的回答,由SO网友:Milo 整理而成

Search Everything 不修改搜索表单,它只修改搜索执行的查询。除了在搜索结果的内容内,您不会在前端看到任何更改。

结束

相关推荐

从非核心php文件访问BloInfo、Get_Option和plugins_url

我正在创建一个插件,插件目录中有一个php文件,可以通过自定义重写url直接访问该文件。我需要这个文件能够使用标题中提到的三个功能。目前,我正在包括wp负载。php文件,它使我能够访问所有这些函数。然而,我一直在读到不应该包括wp负载,因为它可能不总是在同一个位置,而且它包括可能不需要的wordpress文件。这就是我如何包含wp负载:$wp_base = explode($_SERVER[\'PHP_SELF\'], $_SERVER[\'SCRIPT_FILENAME\']); require