使用SHORTINIT加载时如何加载一个特定的WP插件

时间:2018-11-19 18:55:37

标签: wordpress wordpress-theming

使用下面的代码,我们已经使用SHORTINIT成功加载了WP,以支持我们API的一部分。但是,我们还需要能够加载一个WP插件,并且似乎无法加载。

这部分效果很好(在WordPress 4.9.8上):

tensor

我们还能够成功加载主题功能:

size

但是,用于插件的相同方法似乎无效:

    define('SHORTINIT', true);
    require_once $wploadpath;
    require_once $wpincludepath . '/class-wp-user.php';
    require_once $wpincludepath . '/class-wp-roles.php';
    require_once $wpincludepath . '/class-wp-role.php';
    require_once $wpincludepath . '/class-wp-session-tokens.php';
    require_once $wpincludepath . '/class-wp-user-meta-session-tokens.php';
    require_once $wpincludepath . '/formatting.php';
    require_once $wpincludepath . '/capabilities.php';
    require_once $wpincludepath . '/user.php';
    require_once $wpincludepath . '/meta.php';
    require_once $wpincludepath . '/vars.php';
    require_once $wpincludepath . '/kses.php';
    require_once $wpincludepath . '/rest-api.php';
    require_once $wpincludepath . '/pluggable.php';
    wp_cookie_constants();

我们尝试包含更多包含内容,但无济于事:

    require_once $wpincludepath . '/../wp-content/themes/ourtheme/functions.php';

没有错误产生,但是我们没有插件功能。是否可以使用SHORTINIT完全加载WP插件?如果是这样,怎么办?谢谢!

0 个答案:

没有答案