设置脚本以触发WP的Search Unleashed Re-index功能(对于cron)

时间:2013-02-09 07:25:33

标签: php jquery wordpress indexing cron

Search Unleashed应该在每次有人创建新帖子时自动将新帖子添加到其索引中。但是,对于任何自定义帖子类型下的帖子,似乎都不会发生这种情况。

我可以使用SU的重新索引按钮手动触发仪表板内部的重新索引。但是我想用cron自动化它。

我现在正在尝试设置一个可以通过cron运行的脚本。这就是我到目前为止所做的:

<?php

    // Fire up wordpress
    include $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php';

    /*
     * We're calling this function from the plugin folder, inside the content
     * directory (as opposed to the admin directory) – so when wp-load is called,
     * we're not going to be in the admin section, and we're not going to get access
     * to those functions.  On the bright side, we also don't have to deal with
     * WordPress forcing you to login.  Since we still need those admin functions,
     * include wp-admin/admin-functions.php.  This loads up the admin side and gives
     * us access to the admin functions
    */
    include $_SERVER['DOCUMENT_ROOT'] . '/wp-admin/admin-functions.php';
?>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script type="text/javascript" >
        $.noConflict();
        jQuery(document).ready(function ($) {
        jQuery('#wrapper').Progressor( {
            start:    jQuery('input[name=reindex]'),
            cancel:   'Cancel',
            url:      '<?php echo admin_url('admin-ajax.php') ?>',
            nonce:    '<?php echo wp_create_nonce ('searchunleashed-index')?>',
            finished: 'Finished!'
        });
    });
    </script>
<?php

?>

然而,它没有做到这一点。有什么我想念的吗?

0 个答案:

没有答案