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

我尝试在wp-config.php文件中添加define('algolia_loopback_http',true(,并遵循其他说明的步骤:
https://community.algolia.com/wordpress/frequally-asked-questions.html

我处于死胡同,不确定现在该怎么做,因为阿尔戈利亚索引不会发生。我该如何解决?

WordPress的Algolia插件需要能够通过HTTP或HTTPS访问管理员界面。这是它创建一个循环处理待处理任务的方式。

根据您的日志:'BASIC REALM ="限制"',您的管理员似乎在基本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' );

请注意,随着我们正在努力删除逻辑。

,这可能会发生变化。

最新更新