We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, I've been trying to make a basic auth for a custom route that I made but couldn't find how to do so.
Here's my code:
function AllPostsByDESCDate( $data ) { $posts = get_posts(array( 'posts_per_page' => 10, 'paged' => $data['paged'], 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => array( 'post', 'page', 'custom-post-type' ), // custom post types 'post_status' => 'publish', 'suppress_filters' => true )); if ( empty( $posts ) ) { return null; } return $posts; }
function AllPostsByDESCDate( $data ) { $posts = get_posts(array( 'posts_per_page' => 10, 'paged' => $data['paged'], 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => array( 'post', 'page', 'custom-post-type' ), // custom post types 'post_status' => 'publish', 'suppress_filters' => true ));
if ( empty( $posts ) ) { return null; }
return $posts; }
I can send a get http request without Basic Auth while sending an http request to wp-prefix/v2/posts requires me to Basic Auth.
register_rest_route( 'wp-prefix/v2', '/AllPostsByDESCDate/(?P[a-zA-Z0-9-]+)', array( 'methods' => 'GET', 'callback' => 'AllPostsByDESCDate' ) );
I'm using REST API TOOLBOX (https://he.wordpress.org/plugins/rest-api-toolbox/) to choose which endpoint requires an auth
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello, I've been trying to make a basic auth for a custom route that I made but couldn't find how to do so.
Here's my code:
I can send a get http request without Basic Auth while sending an http request to wp-prefix/v2/posts requires me to Basic Auth.
I'm using REST API TOOLBOX (https://he.wordpress.org/plugins/rest-api-toolbox/) to choose which endpoint requires an auth
The text was updated successfully, but these errors were encountered: