2017-11-30 62 views

答えて

0

にアクセスできることはフックrest_indexが存在するログイン、https://developer.wordpress.org/reference/hooks/rest_index/のドキュメントを記述することを返します。

これは、記述したデータが含まれていますAPI。これには、サポートされている認証スキーム、サポートされている名前空間、APIで利用可能なルート 、およびサイトに関する少量のデータに関する情報 が含まれます。私は、必要に応じて

次のコードは完璧に働いている:

function my_site_rest_index($response){ 
    return array(); 
} 
add_filter('rest_index', 'my_site_rest_index'); 
1
function chuck_disable_rest_endpoints($access) { 
    if(! is_user_logged_in()) { 
     return new WP_Error('rest_cannot_access', __('Only logged users are able to call REST API.', 'disable-json-api'), array('status' => rest_authorization_required_code())); 
    }return $access;                
}             
add_filter('rest_authentication_errors', 'chuck_disable_rest_endpoints'); 

これが唯一のユーザーは、バージョン4.4.0からAPI

関連する問題