Problem:
The issue here is that the user wanted to list out all their posts that do not have a specific custom field.
Solution:
Unfortunately this isn't possible to do through the use of the User interface and as such a custom filter is required.
The code below should be able to resolve this.
add_filter( 'wpv_filter_query', 'display_not_exist_posts', 99, 3 ); function display_not_exist_posts( $query_args, $view_settings, $views_id ) { if ( $views_id == 123 ) { // if it is specific view and by default $query_args['meta_query'][] = array( 'key' => 'wpcf-customfieldslug', 'compare' => 'NOT EXISTS', ); } return $query_args; }
Add this code to the Toolset custom code section in Toolset->Settings->Custom code and activate it.
Change 123 to the ID of your view and wpcf-customfeldslug to the slug of your custom field keeping the wpcf- slug
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.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
This topic contains 2 replies, has 2 voices.
Last updated by 4 years, 4 months ago.
Assisted by: Shane.