0

I'm trying to search in title and content of the different custom fields.

$args = array('exclude_from_search' => array( 'order-request'),
        "post_type" => array('post','document','page','event','product'),
        's' =>  get_search_query()
    );
$context['posts'] = Timber::get_posts($args);

But when I search something like "Example ' Assistants" even when that is the title of a post if I search "Example" the post is there. How can I include some special characters ?

UserEsp
  • 415
  • 1
  • 7
  • 29
  • 1
    I'm not near a working wordpress install to test this for you, but have a look at [this answer](https://stackoverflow.com/a/42405614/6049581) – Frits Jul 07 '18 at 04:45

1 Answers1

0

The trick is change the default escaped value in true as false. https://developer.wordpress.org/reference/functions/get_search_query/

's' =>  get_search_query(false)
UserEsp
  • 415
  • 1
  • 7
  • 29