Richard Korthuis
Forum Replies Created
-
Forum: Plugins
In reply to: [WP REST Cache] Plugin DB errorHi @temak
Thank you for using our plugin!
We just released a new version of our plugin, which should solve your issue. Please let me know if it works for you!Forum: Plugins
In reply to: [WP REST Cache] Store the data in another Redis database?Hi @hirngesicht
WP REST Cache itself doesn’t talk to Redis directly — it stores everything through the WordPress Transients API (with awp_rest_cache_key prefix). The fact that your caches end up in Redis means you have an external object cache drop-in active (e.g. the Redis Object Cache plugin by Till Krüss, or similar), and that drop-in is what decides which Redis database is used.
Most Redis object cache drop-ins use a single Redis database for all of WordPress and expose aWP_REDIS_DATABASEconstant (in wp-config.php) to choose which one — but only one. They don’t natively support routing a subset of transients to a different DB.
If you want WP REST Cache transients specifically in a separate Redis database, you’d need a custom/modified object cache drop-in that detects thewp_rest_cache_key prefix (or the underlying _transient_wp_rest_cache_*option name) and opens a second Redis connection on a different DB index for those keys. That’s outside the scope of this plugin, but it’s the layer you’d need to customise.Forum: Plugins
In reply to: [WP REST Cache] WP REST Cache 504 Timeout in version 2026.1.2Hi @kaldata
Thank you for using our plugin and sorry you experienced this issue.
We just released a new version of our plugin which should resolve this issue, can you please test?Forum: Plugins
In reply to: [WP REST Cache] PHP Warning: Undefined array key “path”Hi @djibs13
Thank you for using our plugin!
We just released a new version of our plugin, which should solve this warning.Forum: Plugins
In reply to: [WP REST Cache] I see two versions of the plugin on my site@elmalak For now simply activating the regular plugin should be enough. When the mu-plugin needs updating the regular plugin will handle it.
Forum: Plugins
In reply to: [WP REST Cache] I see two versions of the plugin on my siteHi @elmalak
Thank you for using our plugin!
It is completely normal that you have a mu-plugin and a normal plugin. The mu-plugin is needed to hook into WordPress very early in order to serve the cache before other plugins are executed. What is not normal is that you say that the normal plugin is deactivated. Deactivating that plugin should remove the mu-plugin automatically. Without the normal plugin activated the mu-plugin will not do anything.
With regards to the versions: the normal plugin is the one that gets updated frequently, because that holds almost all the logic. The mu-plugin is rarely updated, since it’s functionality is limited to loading very early, so that is why that plugin is still at version 2021.3.0Hi @kaldata
We just released a new version of our plugin which should solve your problemHi @kaldata
Thank you for using our plugin and sorry you are experiencing this issue.
There isn’t a fltler to disable this functionality in this version. We hadn’t considered this usage of the post meta, so we will be releasing a new version of our plugin soon which will introduce a filter, but this will be a filter to ENABLE this functionality. So when this new version is released everything will be working again as it did before the previous release, you won’t be needing to add a filter if you don’t want caches to be cleared on post meta update.
I will let you know once the new version is released.Forum: Plugins
In reply to: [WP REST Cache] Feature request: add hook to critical funtions for loggingHi @lesandles
Thank you for using our plugin!
We are willing to consider adding hooks where they might be useful. Which functions (besidesdelete_all_caches()) are you thinking about? And are there any variables you would like to receive through that hook?Forum: Plugins
In reply to: [WP REST Cache] permission_callback is not workingHi @papazetis
Thank you for using our plugin!
The reason this happens is because of how our plugin is set up. It hooks into the WordPress process really early (using a mu-plugin) to check if a cache is available for the current REST request. If so it returns the cache and quits the rest of WordPress process. So any actions done by plugins or other code (like for thepermission_callback) isn’t executed anymore.
Now there are two possible solutions I see to your issue. One is to save the authorization header, like I described in my response here: https://ww.wp.xz.cn/support/topic/private-cache-for-rest-endpoints-with-a-authorization-header/#post-12813691
The other one is to hook into the filterwp_rest_cache/skip_cachingand do your permission check there and have it return true if there is no permission (i.e. have it skip caching in this case and therefore returning the response as if no caching exists). Please keep in mind that using that filter would require you to do so from a mu-plugin which comes alfabetically beforewp-rest-cache.phpForum: Plugins
In reply to: [WP REST Cache] Basic Auth on endpointsHi @abelito
Thank you for using our plugin!
Please have a look at my response in this topic for a possible solution: https://ww.wp.xz.cn/support/topic/private-cache-for-rest-endpoints-with-a-authorization-header/#post-12813691
Hi @hirngesicht
Yesterday we released a new version of our plugin, which includes this feature!Forum: Plugins
In reply to: [WP REST Cache] Filebird folder disappears when activatedHi @jminst
Thank you for using our plugin! And sorry to hear you are having this issue.
I just did some tests with the Filebird plugin both with the WP REST Cache plugin activated as with it disabled. I did however not see any issues. Did you happen to configure the Filebird REST API for caching? If you are not sure you can check by going to Settings > WP REST Cache > tab Endpoint API Caches and see if there are any caches withfilebird/v1in the Request URI.Forum: Plugins
In reply to: [WP REST Cache] How to ignore parameters in the url?Hi @bizbergthemes
Thank you for using our plugin!
My solution would be to make use of thewp_rest_cache/skip_cachingfilter. This should however be used inside a mu-plugin which comes alphabetically before wp-rest-cache.php (This is because of the way our plugin works). If you use this filter and have it returntruein your use case, our plugin will not return a cache record.
So if you were to create a fileskip-balance-cache.phpinside the wp-contents/mu-plugins directory with something like this it should probably work:<?php
/**
* Skip cache if the balance parameter is used.
*
* @param bool $skip True if cache should be skipped.
* @return bool
*/
function wprc_skip_balance_cache( $skip ) {
if ( isset ( $_GET['balance'] ) ) {
$skip = true;
}
return $skip;
}
add_filter( 'wp_rest_cache/skip_caching', 'wprc_skip_balance_cache' );N.B. I did not test this code, I just typed it.
Forum: Plugins
In reply to: [WP REST Cache] How to get the current user in the skip_nonce_cache filterHi @hellogareth
Thank you for using our plugin and for your kind words!
I would use thewp_rest_cache/skip_cachingfilter for what you want to achieve, but the principle is the same. I just did a test and the following was working for me:add_filter('wp_rest_cache/skip_caching', 'wprc_skip_caching' );
function wprc_skip_caching() {
if ( is_multisite() ) {
ms_cookie_constants();
}
wp_cookie_constants();
require_once ABSPATH . WPINC . '/pluggable.php';
add_filter('application_password_is_api_request', '__return_true' );
$user = wp_get_current_user();
if ( $user && $user->exists() ) {
return false; // Allow caching for logged-in users
}
return true; // Do not allow caching for non-logged-in users
}Please keep in mind: this is assuming you are using WordPress own authentication like the Application Password, if you are using a seperate plugin it will not work this way.