Skip to main content

Questions tagged [search]

The method by which users find information on your WordPress site

55 votes
8 answers
239k views

How to create a custom search for custom post type?

I have a search field for the blog posts, but I need an other for a custom post type. How can I create this custom search form with a different search result layout?
robert's user avatar
  • 567
51 votes
6 answers
39k views

Extending the search context in the admin list post screen

I have created a custom post type and have attached some custom fields to it. Now I would like to the search that authors can perform on the custom post list screen (in the admin backend) to also be ...
Stefano's user avatar
  • 1,261
43 votes
2 answers
53k views

Customizing Only a Specific Menu using the "wp_nav_menu_items" Hook?

Thanks to some help on here, I've managed to add a custom search box to my main menu... by adding this to my theme's functions.php add_filter('wp_nav_menu_items','search_box_function'); function ...
cannyboy's user avatar
  • 1,033
40 votes
13 answers
103k views

Using meta query ('meta_query') with a search query ('s')

Trying to build a search that not only searches the defaults (title, content etc) but also a specific custom field. My current query: $args = array( 'post_type' => 'post', 's' => $query, ...
luke's user avatar
  • 649
39 votes
6 answers
61k views

Include custom taxonomy term in search

I have two custom taxonomies applied to two custom post types. the terms list on the sidebar just fine and will list all posts associated with it. However, if you search one of the terms in specific, ...
Norcross's user avatar
  • 3,077
32 votes
4 answers
71k views

Advanced search form with filters for custom taxonomies and custom fields

I'd like to build an advanced search form for a specific custom post type, having filters for the custom post types custom fields, custom taxonomies, and for a separate custom post types properties (...
pax's user avatar
  • 633
29 votes
1 answer
30k views

how to limit search to post titles?

Is there a way to limit search to post titles? I know I can modify query.php core file but there must be a way to do it with hooks right? Thanks in advance!
Javier Villanueva's user avatar
26 votes
3 answers
8k views

Can I force WP_Query to return no results?

I'm working on a website with a search feature that allows users to search through a lot of post meta. There is a specific search pattern that I would like to forcibly return no results for. The ...
somebodysomewhere's user avatar
23 votes
3 answers
10k views

How to create live autofill search?

I am currently trying to create a wordpress search function that shows live results underneath the search bar. There is an example on the World Bank website (screens below). I'm not looking for an ...
mmaximalist's user avatar
21 votes
1 answer
42k views

Post_count only shows the number of results per page

I have a wp_query $wp_query = new WP_Query($args); but for some reason the $wp_query->post_count only shows the amount of posts on each page. So if I set 'showposts' => '10' and 12 results are ...
zilj's user avatar
  • 373
21 votes
3 answers
26k views

How can I implement a location based (zip code) search in WordPress?

I am working on a local business directory site that will use custom post types for the business entries. One of the fields will be "Zip Code." How can I set up a location based search? I'd like ...
matt's user avatar
  • 1,652
19 votes
4 answers
21k views

How to highlight search terms without plugin

How can I get the search terms highlighted without plugin?
t-p's user avatar
  • 191
18 votes
5 answers
21k views

How do I remove Pages from search?

I don't need to search for pages in my site and only want to search posts, is there a way to do it? Thanks
user avatar
16 votes
6 answers
46k views

How to make search include data from wp_postmeta?

I have a site using Advanced Custom Fields to create and store various bits of relevant info. These need to be included in the main general search, which by default only searches the title and main ...
Jodi Warren's user avatar
16 votes
8 answers
33k views

Empty search returns home page, how to return not found search page?

The default search function if the search form is empty returns the home page, I want it to return a "sorry your search returned no results" page. this post doesn't answer it and this ticket tells ...
Drai's user avatar
  • 634

15 30 50 per page
1
2 3 4 5
123