已经解决了,是模版默认屏蔽了这个功能,到Functions.php删除了屏蔽rest api的代码。
//屏蔽 REST API
add_filter(\'json_enabled\', \'__return_false\' );
add_filter(\'json_jsonp_enabled\', \'__return_false\' );
add_filter(\'rest_enabled\', \'__return_false\');
add_filter(\'rest_jsonp_enabled\', \'__return_false\');
// 移除头部 wp-json 标签和 HTTP header 中的 link
remove_action(\'wp_head\', \'rest_output_link_wp_head\', 10 );
remove_action(\'template_redirect\', \'rest_output_link_header\', 11 );