Skip to main content

All Questions

Tagged with
0 votes
1 answer
56 views

search filter for search and tag page doesn't work

Here is my search function in functions.php function search_filter($query) { if ( ! is_admin() && $query->is_main_query() ) { if ( ($query->is_tag() ) || ( $query-> ...
made leod's user avatar
1 vote
2 answers
57 views

Search for portfolio tags & mixing portfoliotags and post tags

I have been trying to filter my search result without success. Here is my function in functions.php I want to retrieve only post and portfolio posts (no pages). Below is the code I found on your ...
made leod's user avatar
0 votes
0 answers
11 views

Search Filter by mime type not working in pre_get_posts

I'm trying to create a search option for users to display only PDF attachment posts. The following works to display all attachments: function CustomSearchFilter($query) { if( (! is_admin() ) &&...
jchwebdev's user avatar
  • 775
0 votes
0 answers
58 views

Search query alteration not working for meta values

The bellow code works on category archive pages, it filters out the necessary products. But on the search page it doesn't work. If I uncomment the line //$query->set("s", "chelsea&...
JorensM's user avatar
  • 101
0 votes
1 answer
240 views

Amend taxonomy to search in wordpress admin

I am trying to amend a custom taxonomy to a search in the editor area. The taxonomy slug is 'help_cat' and is attached to 'help-center' post types. What I am trying to achieve is very similar with OP ...
tearswep's user avatar
0 votes
0 answers
144 views

Block internal search queries with pre_get_posts and regex rules

This relates to my previous question: Internal search spam (UPD: I no longer use Ivory Search) The closest question I found: Block search keywords As I understood, I need to use pre_get_posts, but I ...
Terry's user avatar
  • 1
1 vote
1 answer
137 views

How to do multiple searches (with logical OR) in WP_Query in hook pre_get_posts?

Example: $query->set('s', 'foo bar'); - search foo bar I want set search as foo bar OR lorem ipsum dolor OR ping pong
Мегакот's user avatar
1 vote
1 answer
1k views

Wordpress custom search form with pre_get_posts not work

I am designing my first theme and I am stuck on the search functionalities of a Custom Post Type. I created a CPT 'movies' and created the archive page with the 'archive-movies.php' file in the root ...
Wolftrick's user avatar
0 votes
0 answers
28 views

Search Exact on WordPress - Relevannsi Solution Not Working

I have read a lot of articles about exact keyword query problems in WordPress and how to fix them, even though I have followed them but still no success. My website is under construction about ...
jayjay's user avatar
  • 1
0 votes
0 answers
209 views

Excluding posts from search results page with meta query not working

On my search results page I have two loops. First loop displays post by meta value and second loop is "regular" loop that display posts by search query: <section> <div class=&...
Juraj's user avatar
  • 144
1 vote
1 answer
79 views

Replace/Mute/Stop Search Query

I'm trying to replace the search functionality in WP. I've already created the search.php template with all the results I want to display. I don't want any results from the WP database. I just want ...
fat_mike's user avatar
  • 111
0 votes
1 answer
1k views

How to exclude woocommerece product category in search results?

I'm looking for a way to exclude a product category from search results with Woocommerce using the pre_get_posts action and $query->set(). I am searching using the Wordpress ?s=keyword search. I know ...
AlanP's user avatar
  • 721
1 vote
1 answer
497 views

Prevent A Specific Custom Post Type Showing In WP Search Results Page

I've excluded certain pages from the WP Search with the code below in my functions.php file. I also need to exclude a custom post type called 'sites'. I can't seem to find the custom post type ...
pjk_ok's user avatar
  • 908
2 votes
2 answers
3k views

pre_get_posts and search query for admin

I'm going round in circles with trying to include several custom fields in my search results. The custom fields are managed via ACF. At first I want this for the admin. /wp-admin/edit.php?post_type=...
v3nt's user avatar
  • 1,689
3 votes
1 answer
7k views

Add custom field (value) to search result (without plugin)

I need to add custom field to wordpress search result. This what i tried to do is used pre_get_posts filter, like this: function search_filter( $query ) { $key_fields = array ( 'buty' ); $...
kanlukasz's user avatar
  • 504

15 30 50 per page