The Charitable plugin provides a Campaigns shortcode/widget/block which can be filtered using Search & Filter Fields & Queries.
1. Set your Query to “Custom”

2. Set the Post Type to “Campaigns”

3. Add the PHP Code Snippet
Add to your child themes functions.php file or using a code snippets plugin:
PHP
add_filter(
'charitable_campaigns_shortcode_query_args',
function ( $query_args ) {
// Attach Search & Filter Query with the ID 123.
$query_args ['search_filter_query_id'] = 123;
return $query_args ;
},
10,
1
);Note: you must replace 123, with your Search & Filter Query ID.
This will apply to all Charitable campaign widgets on your site. If you have multiple you should conditionally apply to the page where you’ve added it.
Check the Post ID of the before attaching Search & Filter to the Charitable Campaigns widget
PHP
add_filter(
'charitable_campaigns_shortcode_query_args',
function ( $query_args ) {
// Check if the current page has the id `9`
// before attaching Search & Filter.
if ( ! is_page( 9 ) ) {
return $query_args;
}
$query_args['search_filter_query_id'] = 123;
return $query_args;
},
10,
1
);Note: you must replace 123, with your Search & Filter Query ID and 9 with the Page ID you want to restrict to.