Questions tagged [search]

The method by which users find information on your WordPress site

644 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
1answer
1k views

Admin Area Custom Type Search By Meta Fields Without Title & Content

I have a custom post type that uses several meta fields. In the admin area I would like to be able to search by those meta fields. I have implemented this currently in my functions.php with this code: ...
4
votes
1answer
1k views

Exclude custom taxonomy from search results and archive pages

UPDATE: I have the following code working. It excludes the taxonomy from the search results. However, I would like this only to happen if a user is not logged in. The code below is taking effect for ...
4
votes
0answers
376 views

Should I hint table index for search query on wp_post

I'm currently inspecting a WordPress setup with multiple custom post types that should be included into search results. The database query for a search after the word Search looks like this: SELECT ...
3
votes
1answer
62 views

searching in custom meta field

I have multiples custom field in a post type. i can save data, update and display, all fine. now I'm doing the search engine. as it is a library, it must be possible to search in specific fields (...
3
votes
2answers
5k views

Search results don't show products

my website is a woocommerce site and it has blog posts and some pages. My problem is the search box. Everytime I searched it only shows the posts and pages results. It is not showing woocommerce ...
3
votes
0answers
1k views

Searchable meta value in user.php

I have created a new column in the user table list (admin page) and would like the column to be searchable in the search query, How do i add the meta to the search users query ? /** * Create user ...
3
votes
1answer
49 views

How do I get the total number of categories in a list of search results?

I want to display the total count of categories in a set of search results. For example, "10 posts found in 3 categories." (Assuming that each post has only 1 category.) Right now, my solution is to ...
3
votes
1answer
2k views

How to search only by post title and category?

I'm currently working on my first theme (based on underscores) and just realized the search does not return any results if I input a category name, nor does it give accurate results when searching ...
3
votes
0answers
126 views

Unable to create custom search results template page

I'm trying to create a search results page for our website and referring to the following documentation: https://codex.wordpress.org/Creating_a_Search_Page I created a new page template searchpage....
2
votes
0answers
24 views

Custom Post Type not appearing in website search

I've built a custom theme from scratch for a client and have a few custom post types. For one in particular, FAQ, I wanted to hide it from showing individual posts (posts would only appear on its ...
2
votes
0answers
38 views

Automatically adding category filter based on search string

Like ebay and amazon, i want to implement something on my site wherby if someone searches e.g red dresses then the category "Women's dresses" is only searched within. As seen as below, a generic ...
2
votes
1answer
325 views

WP Query search for attachments and their exact title

Due to lack of reputation, I must now ask the question. I want to create a search for all images in the media libary. The search result should only appear if you search for the exact title of the ...
2
votes
1answer
966 views

Search not working with title and content

I am working on search. I am able to search post by tag and category but not able to search by title and content. I tried below code but it's not working. Would you help me out? $getSearch = ...
2
votes
0answers
179 views

Make Wordpress Search for Both Main Domain and Subdomain

I have check through Stackexchange, but no topic is similar to this topic to this. Is there any way to make WordPress search work for both main site and subdomain? Both of them have two separate ...
2
votes
0answers
59 views

How to search Woo Commerce products with punctuation in title?

How do I modify the default WooCommerce Product search so that products with punctuation in the title can be found without including the punctuation in the query? For example, if I have a product ...
2
votes
0answers
794 views

Search query - exact post title match

I have a bunch of posts titled something like this... English Language 2015 English Language 2016 English Language 2017 English Language 2018 And on each one of these posts I have a dropdown select ...
2
votes
0answers
582 views

Search user metadata with checkboxes via ajax (almost working)

I have created an ajax search form following some tutorials online, it is working but not exactly how I need it to. Here is where I got the search from. I have US states setup as a user meta field ...
2
votes
1answer
389 views

Trim the search result around the search word

I want to trim my search results page down to 20 words before and 20 words after the highlighted search word. I am getting accurate search results and the search word is highlighting. I have tried ...
2
votes
1answer
50 views

Related Tags Concept

On search results pages I would like to show a tag list collected from other posts that are listed for the seach result. // same tag should not be listed twice And for the taxonomy pages again; tags ...
2
votes
0answers
256 views

How do I dynamically generate args for wp_query?

I am trying to build up my search args depending on variables passed through from a form. What I want to do is add to args if values are present. For example if there are dates I have: $args = ...
2
votes
0answers
648 views

WP_User_Query search with multiple search queries

Is it possible to perform a WP_User_Query with multiple search queries? Something like: $args = array ( 'search' => '*example.com OR *abc.com', 'search_columns' => array( 'user_email'...
2
votes
1answer
116 views

How can I reuse the Wordpress search form for a custom plugin / widget?

I need to develop a custom widget to display posts, based on their ID. The user must be able to handpick posts. Right now, they can enter the post ID, but it is not convenient for them. Is it ...
2
votes
1answer
432 views

update default search function and get postmeta entries

I want to get post meta entries in woocommerce. When user search anything from default search bar. Data should be also returned from post meta table. So basically I need to modify the default ...
2
votes
1answer
877 views

How to add additional search terms (e.g. synonyms) to the search?

I'm running a blog about different software tools. I frequently use the search to find articles that I wrote for the blog. I also wrote an article about latexdiff, but always forget the name and try ...
2
votes
1answer
1k views

Make Search Function include subdomain (blog.ourwebsite.com)

Wondering if there's a way to edit our search.php or .htaccess or function.php (or anything else...) so that our search function on our main site (www.oursite.com) includes the subdomain of blog....
2
votes
1answer
349 views

Custom Fields vs Separate Table

I have a client who wants to be able to upload Posts using information stored in a CSV file. I've already got this portion working. Just recently, I changed the CSV File Uploader from pure PHP to an ...
2
votes
1answer
336 views

Replace default Wordpress search behavior with Sphinx

I want to implement Sphinx Search in my Wordpress site but I'm not exactly sure how to change Wordpress search behavior to use Sphinx. How do I get Sphinx Search engine to replace whatever Wordpress ...
2
votes
2answers
338 views

CPT Meta Searching

I'm developing a WP plugin which uses custom post types and meta data. What I'm trying to achieve is having the meta data searchable. Here is some code that I found which searches the meta data fine, ...
2
votes
1answer
2k views

Help with multiple dropdown tags search

I'm trying to build a search form that allows the user to choose certain post tags and filter through real estate listings. So far I have the form built but when I click the search button it brings me ...
1
vote
0answers
27 views

How can I use WP_Site_Query to find a blog by blog name?

WP_Site_Query accepts a search argument but if a search term or phrase is supplied, only the path and domain columns can be searched. The site_search_columns filter allows filtering of the columns to ...
1
vote
0answers
35 views

How to make the WP query search for the “s” arg in other places too

By default, the WP query searches for the "s" arg in the post title, content and excerpt. How can I extend this and make it search in other places as well, such as author display name? ...
1
vote
1answer
40 views

meta_query search names when they have middle initials

I have to build a search form where I search members of the company by their Full Name (First Name + Middle Initial + Last Name). All the names are in this form: John B. Doe The below code is working ...
1
vote
0answers
17 views

Editing the default wordpress search

My wordpress sites search function is not relaxed enough for my liking. I want it to match more items and be less strict. How would i do this? I was thinking it would to do a pre-get posts filter but ...
1
vote
0answers
20 views

WordPress API for search

I have a search form for users on my website. I have a custom field called 'location' which is a country dropdown. If I type in a user's name and select a country from the dropdown I see this in the ...
1
vote
0answers
38 views

Redirect template based on permalink rather than $wp_query

I'm trying to separate out different templates which utilise WordPress' search (s query var) along with different post types. Situation 1: Default WordPress search page (search.php). Example: example....
1
vote
0answers
21 views

How to use wp_query to post count by search term > group post count by date > convert to json. (ex. result 12-21-2020 - 343)

Im trying to create a graph that displays count of post per day and display it on the search result page. Search Example. User searches with the search term "football". The search result ...
1
vote
0answers
29 views

Get most searched keywords in WordPress

Normally, visitors of a website search for random keywords. Some keywords searched by many people. Is it possible to get a list of keywords along with the number of search volumes that are searched by ...
1
vote
0answers
40 views

Wordpress sort search results by custom order

I want to search "sandwich" I have pages as "sandwich", sandwich-toast, sandwich-three-layer, sandwich-simple posts as "sandwich-recipe", "sandwich-maker-links",...
1
vote
0answers
25 views

Multiple Search Terms WP_Query

I've tried searching to no avail, and it may be that I'm not sure what it is I'm actually searching for. I am trying to use the WP_Query to display a list of posts that contain ANY (not ALL) of the ...
1
vote
0answers
13 views

Site search needs to find posts for category topic AND Tag or keyword thats not in the post

So I have about 20 categories on the site, one of them is Press Releases. I've been asked to make sure that posts in the press release category only show up in that single category BUT can can also be ...
1
vote
1answer
11 views

Search in custom post type AND in pages with category

I have a search field that's searching in my custom post type bwps with a hidden input: <form class="search-form form-inline" action="<?php echo site_url('/'); ?>" method=&...
1
vote
0answers
93 views

How to search media library alt text and title fields

I need to be able to search in the WordPress media library alt text and title fields. I've previously used a plugin called Media search Enhanced by 1fixdotio (https://wordpress.org/plugins/media-...
1
vote
0answers
20 views

Search media with javascript

For testing purposed I want to search through the media of the featured image. But I can't seem to activate the search. From the admin product detail page I now have: // open featured image document....
1
vote
0answers
26 views

Search bar in table in wordpress

I used this code in the table plugin. It checks data through only one column, I want the code to use all columns. const searchFun = () => { let filter = document.getElementById('myInput').value....
1
vote
1answer
29 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 ...
1
vote
0answers
29 views

Check for taxonomy archive on search results page

I'm looking for a conditional tag to check if a taxonomy archive page(link) is displayed on my search results page. is_tax(); only seems to check if the current page is a taxonomy archive page and ...
1
vote
0answers
16 views

Find user by nicename and open profile

I want to add filter function and show user profile page by using search form. This is what I have now: function test_where_filter($where){ global $wpdb; if( is_search() ) { $search= ...
1
vote
0answers
32 views

Is there a link parameter that will show me all my published pages?

Is there any way to display a loop of all the pages that are published on my website, via a link? (Even while logged out) For example, I can type in domain.com/?s=text and that will create a post ...
1
vote
1answer
305 views

How do I use a block to display search results?

We are using the search gutenberg block on a new gutenberg site for our search form, but can't figure out which block to use on the search results page to display the search results? https://github....
1
vote
0answers
21 views

Separeting product from post in search result

I am trying to separete products from posts in the search result. I can see the loop there search in both. if( have_posts() ) { while( have_posts() ) { ...

1
2 3 4 5
13