Search multiple keywords (php function)

[ad_1]

Hi all!
Is it somehow possible to set WordPress to search multiple keywords? Like red+blue?

I use this code to display specific search results on a page and I would like to be able to set 2 keywords.

<?php 
/*
Template Name: Custom Search Page
*/
$s="your search query";
$args = array(
    's' => $s
);
// The Query
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
    _e("<h2>Search Results for: ".get_query_var('s')."</h2>");
    while ( $the_query->have_posts() ) {
       $the_query->the_post();
             ?>
                <li>
                    <a href="https://projectdmc.org/support/topic/search-multiple-keywords-php-function/<?php the_permalink(); ?>"><?php the_title(); ?></a>
                </li>
             <?php
    }
} 

Thank you.
Radan

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer