limiter l 27acc c3 a8s c3 a0 l 27api rest wordpress

Solutions on MaxInterview for limiter l 27acc c3 a8s c3 a0 l 27api rest wordpress by the best coders in the world

showing results for - "limiter l 27acc c3 a8s c3 a0 l 27api rest wordpress"
Juan Manuel
15 Sep 2017
1// pour autoriser l'acces API REST uniquement au 
2// utilisateurs authentifié
3
4function rest_api_secure( $access ) {
5
6    if( ! is_user_logged_in() ) {
7        return new WP_Error( 'rest_cannot_access', __( 'Accès réservé', 'disable-json-api' ), array( 'status' => rest_authorization_required_code() ) );
8    }
9
10    return $access;
11}
12add_filter( 'rest_authentication_errors', 'rest_api_secure' );