This is how I did it, but I feel it could be better. For one thing, this results in HTTP 500… 403 would be preferable
add_filter( 'json_authentication_errors', function( $authenticated ) {
if( !$authenticated ) {
return new WP_Error('Access Denied');
}
}, 99 );
(I understand this’ll work for Basic Auth too)
Related Posts:
- What is the OAuth 2.0 Bearer Token exactly?
- Sign in with Google temporarily disabled for this app
- “An access token is required to request this resource” while accessing an album / photo with Facebook php sdk
- How do I use the WP REST API plugin and the OAuth Server plugin to allow for registration and login?
- Implement authentication to an organization oAuth server
- OAuth1 empty “authentication” in /wp-json
- WP – API – OAuth 1.0a Server, How to implement with AngularJS?
- oAuth2 Authentication in WordPress using WP OAuth Server and WP API plugins
- What is an Endpoint?
- Use Device Login on Smart TV / Console
- Install oAuth PECL error: Cannot install, php_dir for channel “pecl.php.net” is not writeable by the current user
- Get post count in wp rest API v2 and get all categories
- Override WordPress user with Oauth2 account
- Query WP REST API v2 by multiple meta keys
- WP REST API only returning partial list of users
- Is there a way to get protected meta fields through any of the available built-in WordPress APIs? (xmlrpc, wp-json)
- How to allow users login to WP from external domain and make REST requests
- Fetching private posts or custom post types via WP-API with basic authentication
- How to update/insert custom field(post meta) data with wordpress REST API?
- How to save new transients if query changes?
- Unset data in custom post type WordPress API (wp-json)
- How do I retrieve a list of popular plugins using the WordPress.org Plugin API?
- WP API : date_query parameter
- Get the Category Name instead of ID from WP-API
- WP API to fetch all the media/posts records if count is more than 100
- Add Products to Woocommerce through WP API
- Authentication for a mobile app connected via wp-rest api?
- Can we access the REST request parameters from within the permission_callback to enforce a 401 by returning false?
- Create post with REST API in php with file_get_contents
- WordPress API returns empty page when page is less than X-WP-TotalPages
- WP Rest API max limit include parameter?
- How to filter users on custom meta fields in WP JSON v2?
- Passing Meta array in wp-rest api
- How to make a WP REST API query with meta_query in WP4.7?
- Inserting custom post meta value using WP-REST API
- Get all tags not just first 10 with wp api 2.0
- Mass importing json data into custom fields (postmeta)
- WP REST API V2 – Add user data to response
- How to quickly reorder posts in the admin panel that will persist for the wp-api
- Display post title from WordPress excluding a string via API
- WP_REMOTE_POST Requests are being blocked by API provider [closed]
- Why a strange discrepency between get_current_user_id() when using AJAX versus output of document.cookie?
- Create a range slider to change font-size with different screens sizes in wordpress customizer api
- Woocommerce api: create product with images – bad request
- Update a post based on results from GET request to another server
- Test WordPress api with postman
- Posting page on all subdomains
- WP Rest get all by post within that category, by category name not by cat ID
- WP API: Get posts excluding those with a tag or category name
- Using WordPress as an API [closed]
- How can I list all installed plugins/themes/versions from CLI/API?
- How to edit feature image with XML RPC?
- Return scheduled posts with WP REST API
- Are there events pub/sub for external application to subscribe to file/pdf uploads by wordpress admin
- Get a remote post ID via API given URL
- Core function to check if a rest namespace exists
- Media gallery images url instead of ID on WP API Response
- Get single item from cURL plugin API call inside bash [closed]
- How to change the date and time in REST API for comments?
- How to create WordPress custom end point with multiple parameters?
- Is there a way to download only the Rest API part of WordPress?
- Custom Endpoint API based on attribute gutenberg block
- Google credentials and redirect URI for Google OAuth2 in a WordPress plugin, questions
- How to see posts in taxonomy endpoint
- Uploading a media item with the wp-json API to a specific path
- post values to custom post type which has advanced custom fields
- WooCommerce OAuth 1.0 + JWT authentication with JS/React
- How to add a rest field to post tags?
- Why are tags from the header showing up on my WordPress site? [closed]
- ng-repeat is not returning a list of posts
- Refresh individual comment text via API
- WordPress login set cookie that survive browser exit (wp_signon function)
- How to display relations via wordpress Rest API
- Allow REST API Endpoint to specific user and hide from public
- How can I create new CustomPostType record using wp.api.collections?
- cannot get global $menu value in form request
- do_action in API call
- upload image to wp-api
- register/login api
- How do i post data to url with fields?
- 403 error rest_’cookie_invalid_nonce’ on API Request
- How to use following API with WordPress?
- How to add a post’s view count into the WordPress API response
- wordpress api make 2 custom post type with single request
- Update Custom Post Type Metadata Wp Rest API
- wp_insert_user if user exists
- WooCommerce API Returns 401
- Consume legacy rest api dependent upon WP API plugin
- Hiding WordPress REST endpoints from public viewing using Basic Authentication
- How to make an other web app can login with wordpress authentication?
- How to get custom or filtered endpoints in WordPress API?
- WP API users per page
- Combining results from WP-API using AngularJS
- Remove a field from json in wp rest api v1
- WP REST API v2. filters doesn’t work
- WP REST API Access-Control-Allow-Origin response is cached
- Email verification feature in wordpress social login plugin
- How to update WordPress Plugins in your own maintance application?
- How can I use React packages with the clasic editor?
- WordPress User Registration/ Sign Up -> Able to take Paid Certification Courses & keep track of Completed Certificates