Nas*_*yed 1 indexing wordpress search algolia
我在我的WordPress网站上安装了Algolia搜索插件1.7.0.我也设置了它,当我进入索引时,以下显示:
wp_remote_post() failed, indexing won't work. Checkout the logs for more details.
URL called: http://45.77.12.19/wp-admin/admin-post.php
Array
(
[headers] => Requests_Utility_CaseInsensitiveDictionary Object
(
[data:protected] => Array
(
[server] => nginx/1.12.0
[date] => Tue, 25 Apr 2017 02:23:09 GMT
[content-type] => text/html
[content-length] => 195
[www-authenticate] => Basic realm="Restricted"
)
)
401 Authorization Required
Run Code Online (Sandbox Code Playgroud)
我试图在wp-config.php文件中添加define('ALGOLIA_LOOPBACK_HTTP',true),并按照其他步骤解释:https://community.algolia.com/wordpress/frequently-asked-questions.html
由于algolia索引不会发生,我现在处于死胡同,不确定现在该做什么.我该如何解决这个问题?
WordPress的Algolia插件需要能够通过HTTP或HTTPS访问管理界面.这是它创建循环来处理挂起任务的方式.
根据您的日志:'Basic realm ="Restricted"',您的管理员似乎在Basic Auth(htpasswd)后面受到保护.
要使队列在您的情况下工作,您应该为插件提供凭据.
以下是您需要添加到functions.php活动主题文件中的内容.
<?php
// In your current active theme functions.php.
define( 'MY_USERNAME', 'test' );
define( 'MY_PASSWORD', 'test' );
function custom_loopback_request_args( array $request_args ) {
$request_args['headers']['Authorization'] = 'Basic ' . base64_encode( MY_USERNAME . ':' . MY_PASSWORD );
return $request_args;
}
add_filter( 'algolia_loopback_request_args', 'custom_loopback_request_args' );
Run Code Online (Sandbox Code Playgroud)
请注意,这可能会在接下来的几周内发生变化,因为我们正在努力消除这种逻辑.
| 归档时间: |
|
| 查看次数: |
128 次 |
| 最近记录: |