Richard Korthuis
Forum Replies Created
-
Forum: Plugins
In reply to: [WP REST Yoast Meta] SEO Title Meta follow-upA little later than I said (sorry for that), we just released a new version of the plugin with this fix in it.
Forum: Plugins
In reply to: [WP REST Cache] Use this plugin with custom rest_url_prefixDid you try the code change? Does that work for you?
Forum: Plugins
In reply to: [WP REST Cache] Use this plugin with custom rest_url_prefixHi @efbi
But you are only returning results using the POST? (So not changing any data?)
If so, maybe we can think of a way to make this work for you ??
Maybe we should consider adding a filter hook so you can tell the plugin to also cache POST-requests?
Could you try if it works correctly for you if you change the line
if ( 'GET' !== filter_var( $_SERVER['REQUEST_METHOD'], FILTER_SANITIZE_STRING ) ) {
(in wp-rest-cache/includes/api/class-endpoint-api.php on line 233) to:
if( in_array( filter_var( $_SERVER['REQUEST_METHOD'], FILTER_SANITIZE_STRING ), [ 'GET', 'POST' ], true ) ) {
If so, I will discuss it internally if we can add a filter so you can tell the plugin to also cache POST-requestsForum: Plugins
In reply to: [WP REST Yoast Meta] Twitter Meta Image IssueThis thread has been marked as resolved due to lack of activity.
You’re always welcome to open a new topic.
Thanks for understanding!
Forum: Plugins
In reply to: [WP REST Yoast Meta] User Yoast Social Links not available in REST APIHi @giorgio25b
Thank you for using our plugin!
At this moment we only add Yoast meta to (custom) post type endpoints. We do however have plans to add them to taxonomies and users, but unfortunately at this moment I cannot tell you when that will be added.
Forum: Plugins
In reply to: [WP REST Cache] Problem flushing cache since version 2019.4.3This thread has been marked as resolved due to lack of activity.
You’re always welcome to open a new topic.
Thanks for understanding!
Forum: Plugins
In reply to: [WP REST Cache] How to flush cache on custom endpoints?Hi @jaxwtf
Thank you for using our plugin!
There are several possible answers to your question:
1. You say you want it to flush when you save or update, are these endpoints returning (custom) post types (or taxonomies)? If so then possibly the plugin can not detect the correct object type.
The plugin will try to detect the object types of entries in your endpoint, but this detection is not flawless. It will check for the existence of the fields
id
andtype
and use thetype
as the object type (or check forid
andtaxonomy
in the case of a taxonomy). If those fields aren’t present it will not be able to detect the object type.You can however ‘help’ the plugin to detect the correct object type by using the
wp_rest_cache/determine_object_type filter
(see the FAQ).Once the plugin knows the correct object type it will automatically flush the caches upon saving such a object type.
2. If the endpoint isn’t returning (custom) post types (or taxonomies) I would still recommend using the
wp_rest_cache/determine_object_type filter
hook to help the plugin detect the object type.Once you have done that, upon saving or updating you can programmatically flush all caches of a specific object type
Example:
\WP_Rest_Cache_Plugin\Includes\Caching\Caching::get_instance()->delete_object_type_caches( 'products' );
This deletes all caches for object typeproducts
.3. The last option is to (upon saving or updating) programmatically flush all caches of a specific endpoint. So for instance if you want to flush the caches for the endpoint
/wp-json/wp/v2/pages
you can do so like this:
\WP_Rest_Cache_Plugin\Includes\Caching\Caching::get_instance()->delete_cache_by_endpoint( '/wp-json/wp/v2/pages' );
This function accepts two extra parameters:
1.$strictness
: This defines how strict you want the caches to match, you have three options for this:
'strict'
: Delete caches by an endpoint path matching only this exact same endpoint path (and query params).
'params'
: Delete caches by an endpoint path matching the exact same endpoint path with any query params that might have been used.
'loose'
: Delete caches by an endpoint path matching any cache that was called starting with the endpoint path (ignoring any query params or subpaths following the given path).2.
$force
: Should the caches be deleted ($force = true) or just flushed ($force = false).Forum: Plugins
In reply to: [WP REST Cache] Use this plugin with custom rest_url_prefixHi @efbi
The problem lies with:
'methods' => 'POST',
Our plugin only cachesGET
requests, since all other requests (POST
,PUT
,PATCH
,DELETE
) are meant to change things. OnlyGET
is for retrieving data.Forum: Plugins
In reply to: [WP REST Cache] PHP Fatal ErrorUnfortunately at this point I am unable to help you any further. I am unable to reproduce your error and from what you are telling me I don’t see anything wrong other than the fact that the must use plugin is unable to find the wp-rest-cache plugin.
Forum: Plugins
In reply to: [WP REST Cache] Use this plugin with custom rest_url_prefixHi @efbi
I have done some testing with your code added to my environment and it is working as expected. The prefix is changed and the cache is working.
Are you sure it isn’t working for you?
Forum: Plugins
In reply to: [WP REST Cache] __PHP_Incomplete_Class_NameHi @marlondc
No problem ??
You could user
wp_json_encode(...)
to ensure that the data is indeed valid JSON.Forum: Plugins
In reply to: [WP REST Cache] PHP Fatal ErrorHi @hansgv
Well, those are the correct deletions, but are they really deleted? Because IF they were indeed deleted you would not be able to see the notice anymore, since the plugin that shows the notice is gone.
Forum: Plugins
In reply to: [WP REST Cache] __PHP_Incomplete_Class_NameHi @marlondc
Thank you for using our plugin!
Without looking at the code for your custom endpoint this is hard to debug for me. It seems the result of your endpoint isn’t correct json, but it is all speculation. Is there a possibility you could share the code for your endpoint with us?
Forum: Plugins
In reply to: [WP REST Yoast Meta] SEO Title Meta follow-upYou are absolutely right! As a matter of fact we already had the exact same fix ready for deployment. I will try to release this fix today.
Forum: Plugins
In reply to: [WP REST Yoast Meta] No Yoast with Categories or Custom CategoriesHi @filmboy999
Thank you for using our plugin.
Your issue comes from the fact that we have not (yet) implemented Yoast meta for taxonomies, only for (custom) post types. We will investigate if we can add it to our plugin, but I cannot promise it will be implemented soon.