It seems impossible to make Views form (parametric search) work with memcached (or even just WP Super Cache).
No matter if I use auto_fill parameter for Types fields or not, or simply a taxonomy field, the dropdowns, the options of the dropdowns are always empty in the form.
Please advise a fix and/or give instructions on how to check Views caching/output (debug) so we can tweak it and make this work.
Actually, the issue is specifically when using object-cache.php, inside wp-contents (needed to make memcached work and also used by W3TC).
https://wordpress.org/support/topic/disable-object-cache
https://codex.wordpress.org/Class_Reference/WP_Object_Cache
Im trying to use Views debug, but no popup appears with debug info (after activating it), from a page with the Views form.
Instead, in the console I get:
TypeError: $j.browser is undefined
if (($j.browser.safari || $j.browser.webkit) && window.console) {
Could you maybe advise on how to programmatically delete the cached data generated by the Views form, through a function that uses wp_cache_delete( $key, $group )?
Digging more into the code, I found:
// file wp-views/embedded/inc/wpv.class.php
// function short_tag_wpv_view_form
// Shall we look up in the cache? Is this a Parametric Search View?
$is_cacheable = $this->is_cacheable( $id ) && $this->does_view_have_form_controls( $id );
$cache_id = $this->get_cache_id( $id );
$target_id = $atts['target_id']; // int, > 0
if( $is_cacheable ) {
// Is it cached?
$cached_filter_index = get_option( 'wpv_transient_viewform_index', array() );
$is_cached = isset( $cached_filter_index[$cache_id] ) && $cached_filter_index[$cache_id];
if( $is_cached ) {
$trasient = 'wpv_transient_viewform_'.$cache_id.'_'.$target_id; // strlen() <= 45
$cached_filter = get_transient( $trasient );
if( $cached_filter !== false ) {
array_pop( $this->view_shortcode_attributes );
return $cached_filter;
}
// We should not reach this line if everything is working fine
// But if not, let's continue
}
}
There should be a way to programmatically disable this, so we can assign a $is_cachable = false to a specific view.
Also, there might be a bug in the way the transient is cached/retrieved, since the form fields' options are missing completely in the form.
Please advise, this is urgent.
https://toolset.com/errata/views-features-affected-by-servers-who-change-the-wp-object-cache/
Apparently, after wasting hours on debugging, I had to switch to "Always show all values for inputs" and now the dropdowns show their options finally.
However your issue (in the link) is NOT correct/complete.
Our server doesnt change anything, we are using memcached and this object-cache.php (as many other people) hidden link
Also, even logged in users have that problem.
It could be that object-cache isnt updated and causing issues, however since it's the only one available atm and lots of people use it, it would be great if you could either contribute to it, suggest an alternative (hidden link maybe?) or/and provide a fix for that case in your code.
Dear Sanny,
1) The plugin you are using: Memcached Object Cache
https://wordpress.org/plugins/memcached/
This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
It is not recommended to use such a outdated plugin.
2) There is build-in cache feature in views:
https://toolset.com/documentation/views-shortcodes/#wpv-view
attributes: cached (opt):
Turns off the caching system for the View.
3) here is a document about "Working with Caching Plugins":
https://toolset.com/faq/working-with-caching-plugins/
Hope it help
The caching option for the view isnt useful in this case (turning it off completely would impact the overall experience badly).
The issue occurs only in the form fields of parametric search, as reported also in YOUR open issue here https://toolset.com/errata/views-features-affected-by-servers-who-change-the-wp-object-cache/ so you ARE aware of the issue (nothing to do with other outdated plugins.....)
We already moved to an updated object-cache file, still Views has the same issue.
W3TC is updated, still Views has issues with it apparently... so it would be a great idea for you to look better into how YOU are caching things, because it might not be ideal for memcached/object caching in general.
Caching methods arent going to change just because Views doesnt like it.
Also, better & more detailes Toolset technical documentation (for developers), with articulated examples and workaround for known issues, would be useful.
Thank you