Ce fil est résolu. Voici une description du problème et la solution proposée.
Problem:
How to filter view by custom field of third party plugin/theme which stores serialize data.
Solution:
You can use 'wpv_filter_query" filter to filter your view with custom fields with serialize data.
When displaying a View listing posts, this filter is applied to the arguments being generated by the View settings before they are passed to the WP_Query class. That means you can add/remove query on fly.
Learn more about WP_query and how to use it in WordPress.
This support ticket is created Il y a 7 années et 3 mois. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I'm trying to add "Query Filter" for a custom field set by the theme that I purchased. The problem is, I don't know how to filter custom field having multiple values (see database under postmeta table and views query filter, screenshot attached).
Hello. Thank you for contacting the Toolset support.
You can not filter view with such field which have multiple values using views filter. For such field I suggest you need to use view's filter hook: 'wpv_filter_query".
When displaying a View listing posts, this filter is applied to the arguments being generated by the View settings before they are passed to the WP_Query class. That means you can add/remove query on fly.
For example:
add_filter( 'wpv_filter_query', 'limit_time_on_query', 99, 3 );
function limit_time_on_query($query_args, $view_setting, $view_id)
{
if ($view_id == 999) {
/// ADJUST your query_arguments with your meta query here as per your custom field as meta key and meta values here
}
return $query_args;
}
Where:
Please change "999" with your original view id.