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 );
Problem: Toolset injects some code automatically in the site for Views and Blocks, and I would like to know how to dequeue that code.
Solution: The Toolset Blocks script frontend.js isn’t enqueued normally, an inline script is added to the page to load the script asynchronously. This can be disabled by adding the following constant to wp-config.php:
define( 'TB_SCRIPT_STYLE_LAZY_LOAD', false );
Then the script itself and accompanying stylesheet can be dequeued normally as desired, like so:
Solution:
we are aware of the upcoming FSE capabilities that will start to get included in WordPress 5.8.
The whole idea behind FSE is that the layout of a site should be editable without the need to compose custom themes. However, there are some key differences between what FSE will provide and what Toolset provides.
As a starter, single posts templates in FSE behave pretty much as theme templates: one template to rule all posts of a given type. Toolset gives much more control on which template should be used for each post. In addition, Toolset provides Dynamic Sources, which ensure that blocks used in a template will produce the right content for every post using the template; the mechanism to load dynamic content in templates crated with FSE is not clear yet. Finally, archives created with Toolset offer total freedom for layout and content design, while the new Query block for FSE is still too narrow in capabilities and options.