AnsPress_API::avatar( WP_REST_Request $request )
Description #
Callback for route /anspress/user/avatar/
.
Parameters #
- $requestWP_REST_Request (Required) Request data.
Source #
File: includes/api.php
public static function avatar( $request ) { $args = $request->get_query_params(); if ( isset( $args['id'] ) ) { $size = isset( $args['size'] ) ? (int) $args['size'] : 90; $avatar = get_avatar_url( (int) $args['id'], $size ); return new WP_REST_Response( $avatar, 200 ); } return new WP_Error( 'wrongData', __( 'Wrong data supplied', 'anspress-question-answer' ) ); }
Expand full source code Collapse full source code View on GitHub: includes/api.php:41
Add your comment