Wordpress improve REST API - SHORTINIT not work

i'm trying to improve the performance of Wordpress API custom endpoints.I created a plugin, simple file under plug

i'm trying to improve the performance of Wordpress API custom endpoints.
I created a plugin, simple file under plugin/PLUGIN_NAME folder where I call "register_rest_route" function to set the endpoints.
To improve the performance I am trying to load not all the plugins, but only what I need, Wordpress CORE to query users and posts and Ultimate Members. That's my code:

define('SHORTINIT', true);
require_once dirname(__FILE__) . '/../../../wp-load.php';
require_once dirname(__FILE__) . '/../ultimate-member/ultimate-member.php';

add_action('rest_api_init', function () {

  register_rest_route( 'my-api/v1', 'test/me',array(
              'methods'  => 'POST',
              'callback' => 'test'
     }
  ));
...
...

It work, but the problem is that works also if I not load "wp-load.php" script. In my test method I use WP_User_Query, WP_Query and ultimate member method like um_user().
It seems like SHORTINIT didn't work.
What I wrong ?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745143313a4613529.html

相关推荐

  • Wordpress improve REST API - SHORTINIT not work

    i'm trying to improve the performance of Wordpress API custom endpoints.I created a plugin, simple file under plug

    6小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信