REWORKED ANSWER TO ANSWER THE QUESTION
In order to exclude all pages with a certain template, all you need to do is to run a meta_query
to exclude all pages with the custom field _wp_page_template
set to bedankt
. Remember, WordPress saves the template assigned to a page as a hidden custom field called _wp_page_template
With this in mind, we can do the following
$args = [
's' => $s,
'post_type' => ['post', 'page', 'p24_cases'],
'meta_key' => [
[
'key' => '_wp_page_template',
'value' => 'bedankt.php',
'compare' => 'NOT IN'
]
]
];
ORIGINAL ANSWER – misread question
You simply need to get the post ID of that page, anf then pass it as an array to post__not_in
'post__not_in' => [1], // Replace 1 with actual page ID
Or pre PHP 5.4
'post__not_in' => array( 1 ), // Replace 1 with actual page ID