Problem: I would like to adjust permissions and access for Forms, but I cannot find the Access Control menu item under the main Toolset menu in wp-admin.
Solution: Access Control is part of a separate plugin called Toolset Access. Install and activate the Toolset Access plugin to enable Access Control.
Problem: I would like to prevent search results from appearing until a custom search filter is added.
Solution: Use our PHP Views Filter API wpv_filter_query_post_process to drop a View's results until some meta_query is added. The following custom code can be used as a template:
/**
* No initial results until a filter has been applied
* Tests for one specific custom field search filter
* Reference: https://toolset.com/forums/topic/how-to-disable-the-search-in-view-using-blank/
*/
function tssupp_no_initial_results( $query_results, $view_settings, $view_id ){
$target_views = array( 123, 456 );
$field_slug = 'field-slug';
// you should not edit below this line
if ( in_array( $view_id, $target_views ) ) {
// blank search indicates just blank space in the filter
$blank_search = isset($query_results->query['meta_query']) && sizeof($query_results->query['meta_query']) == 2 && $query_results->query['meta_query'][0]['key'] == 'wpcf-'.$field_slug && trim($query_results->query['meta_query'][0]['value']) == '';
// if there is no search term set, drop all results
if ( !isset( $query_results->query['meta_query'] ) || $blank_search ) {
$query_results->posts = array();
$query_results->post_count = 0;
$query_results->found_posts = 0;
}
}
return $query_results;
}
add_filter( 'wpv_filter_query_post_process', 'tssupp_no_initial_results', 10, 3 );