Here is an untested one-liner, counting the cache data array returned from the magic __get
method, with a fallback to an empty array if the group key is not set:
'numberOfEntries' => count( $wp_object_cache->cache[$group] ?? [] );
Another approach is to consider bindTo to access the private cache array of the $wp_object_cache
instance via closure.
Related Posts:
- Full page NGINX (or Cloudflare) caching and WordPress nonces
- WordPress REST API, Expired Nonce from Cache results in 403 forbidden
- How to cache WordPress oembed links in the page header?
- Rest API nonce is being cached
- How to: Make JWT-authenticated requests to the WordPress API
- How would I add custom tables/endpoints to the WP REST API?
- WP REST API create post authentication issue
- Why is my custom API endpoint not working?
- WordPress REST API validation
- How do I correctly setup an AJAX nonce for WordPress REST API?
- WordPress Rest API: How do we validate with our custom API key?
- Adding WordPress API Endpoint With Multiple Parameters
- Using the REST API (v2) javascript client on a private namespaced route
- authentication issue with rest api – rest_cannot_create
- Hiding API routes list
- Match REST API post output from custom endpoint
- How to change user avatar using REST API?
- rest api authentication
- Does accessing WordPress via REST API affect the site stats and analytics?
- x-wp-nonce is not allowed by Access-Control-Allow-Headers in preflight response
- How to get around WP REST API per page limit without pagination?
- Build on same WordPress or different install?
- Testing custom API endpoint with class dependency
- Not all featured image sizes available in Rest API
- WP API ignores filter parameter
- 403 Forbidden with gutenberg
- WordPress doesn’t send a notification email when submitting a comment using REST API
- Using WordPress RESTapi to call a php file instead of post or page
- Remove caching from wp_remote_get calls from custom plugin
- Detect if REST API is running
- WordPress REST API – Modify JSON before importing
- Using pre_get_posts, how to target the REST API, only?
- Save/update post_meta with Gutenberg from the panel
- Set featured image using URL with wp rest api
- How to block all REST API endpoint except which I wrote custom?
- Authentication with internal WP_REST_Request and rest_do_request()
- pagination in WP rest api
- Can the new REST API now make WP into it’s own push notification server?
- Confused about AngularJS and WordPress
- Post API tax_relation field doesn’t work
- Cannot DIsplay a Snackbar Notice on Button Click – Notice is undefined
- How to post an unserialized array via wordpress rest API as meta data
- Use the backbone.js client to save custom post type meta
- Override WordPress POST REST API
- Custom Post Type and Custom REST API Endpoint result in Gutenberg editor not working
- rest_sanitize_value_from_schema doesn’t sanitize string
- Erratic OAuth 1.0 Signature Mismatch Errors
- WordPress Rest API custom endpoint for RSS feed
- How to add a custom REST field to limit data when fetching?
- Get subscribers via REST API and send post notification
- WordPress JSON data to and from database to be shown on rest point
- “No Access-Control-Allow-Origin header is present” even though it is in the entry file
- REST API authentication for a plugin
- rest api request including meta_query filter
- Rest API basic auth not working
- How to get featured image in WP rest api
- Filter DELETE REST API calls
- Rest API: wp_verify_nonce() fails despite receiving correct nonce value
- Update user meta via REST API?
- How to call wp plugin REST functions without curl?
- Disable part of endpoints wordpress api
- Get a term object using getEntityRecords
- How to send the body in wp_remote_post as “raw”?
- Backbone with custom rest endpoints
- rest Api jwt authentication for get methodes
- Is there a way I can fetch the WordPress Developer Code References with an API?
- Pull in ALL posts from the last two weeks using Rest API
- How to add an endpoint to WP
- How to set up the REST API to refer to media on a CDN
- 403 error when publishing a post in wordpress. Error => Publishing failed. The response is not a valid JSON response
- Cannot use WordPress Application Passwords: “code”: “rest_no_route” “status”:404 for /wp-json/wp/v2/users/me/application-passwords
- IIS Authorization Rules breaks WP REST-API and results in fail in Site Health
- How to delete all instances of the image using REST API
- REST API connection on another site with post information and permalink
- Performance of WordPress Rest API vs WordPress Feeds
- trigger WordPress rest any API call
- How to cache a custom API call?
- WordPress REST API in Integromat: How to overcome “Sorry, you are not allowed to list users / edit this…”
- WP REST API returns empty posts despite entries in wp_posts
- Uploading picture via REST API
- How to modify the HTML output of Gutenberg block? (Youtube)
- rest api add post meta
- phpmailer_init ignored on REST calls
- order by meta start_dato value (ACF)
- Display Post Featured Image along with Categories via WP Rest API
- Register rest field authentication with REST API
- Accessing secure endpoint with X-WP-Nonce?
- Handling _embed for custom REST API endpoints
- Restructure Objects coming from Rest-Api
- Rest api request throttling
- Get custom data from the user REST API endpoint
- Custom rest api endpoint response json problem
- How can I set the default ‘orderby’ and ‘order’ parameters for a REST API call?
- JS WordPress API fetch no response headers
- What filtering is available for backbone.js?
- Woocommerce API for calling products by Category ID
- WordPress custom endpoint returns Security violated
- custom REST endpoints and application passwords
- wordpress rest api authentication failed
- WordPress REST API custom endpoint not allowing multiple parameters