Questions tagged [search]

The method by which users find information on your WordPress site

568 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
1answer
507 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
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: ...
3
votes
1answer
44 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
0answers
120 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....
3
votes
0answers
258 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
2answers
2k views

List posts based on first letter of posts

I want add a pagination How can I do this on both loop.php and search.php. I want show alphabetic index to search only posts with starting letter = [E] for example. Right now, if I search with E it ...
2
votes
2answers
2k 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 ...
2
votes
0answers
457 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
546 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 ...
2
votes
0answers
456 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
48 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
1answer
1k 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 ...
2
votes
0answers
219 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
1answer
102 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
422 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
834 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
325 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
265 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
331 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
1k 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
11 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 ...
1
vote
1answer
61 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 = ...
1
vote
2answers
31 views

Search the product by tag or category not working

I am working on search. I am trying to search the product by tag or category. I tried below code but it's not working. I am getting Nothing Found Also title and content is also not working. ...
1
vote
0answers
13 views

Getting to a specific page on website using specific code instead of navigation bar

Is there a way get to a specific page on a WordPress website by entering in a code instead of going through the navig
1
vote
0answers
16 views

Change Search url slug for each site in a multisite network

As per the title, how would you change the search url for different sites in a multisite network. eg: testsite.co.uk/search testsite.de/suchen testsite.fr/recherche I can change the search term for ...
1
vote
1answer
47 views

Advanced search by two criteria - sort by location and date (ascending or descending)

I have spent a couple of days working on this and I am still not able to figure it out. I am trying to make advanced search filter that sorts posts from a specific category on two criteria: location (...
1
vote
0answers
25 views

Change WordPress search Permalink structure

Please I want to change my WordPress search permalink structure, from + as the separator to - Example: https://wordpress.stackexchange.com/search/please+help+me+out To https://wordpress....
1
vote
0answers
18 views

URL search link for 'category__and' instead of php query

I found this in the WP Docs: Display posts that are in multiple categories. This shows posts that are in both categories 2 and 6: $query = new WP_Query( array( 'category__and' => array( 2, 6 ) ) ); ...
1
vote
0answers
50 views

Wordpress default Search function inconsistent in WooCommerce Product Titles

I have a custom query searching by Post title keyword for WooCommerce. But some words return no results and some words do. This simple query doesn't return all words. Words that work: Dressing ...
1
vote
1answer
32 views

Where does the Yoast SEO plugin set the Open Graph metadata?

The Yoast SEO plugin add this line to the head section of the page: <meta property="og:image" content="https://link.to.image.jpg" /> But according to FB OpenGraph og:image not pulling images (...
1
vote
0answers
28 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 ...
1
vote
0answers
17 views

Woocommerce custom search

I want to build a search form on the homepage where people can search by Product Name Product Category Price range I have found a few results, but a lot of them are filters which display products. ...
1
vote
0answers
22 views

Meta query: How do I return posts within a date period from a given month?

I have posts with a meta start_date and a meta end_date, stored in timestamp format (I can change the format if necessary) I would like to return all posts that have a date in that month by giving a ...
1
vote
0answers
31 views

get search results from only specific page name in wordpress

I have created a page by using add_submenu_page: add_submenu_page( "pharma-plugin", // parent slug "All Trade Name", // page title "All Trade Name", // menu title "manage_options", // ...
1
vote
0answers
55 views

Admin Backend - Search Pages only by title

I want to modify the pages search in the Admin Backend, so that the search only factor the title of the pages and not the whole text/article. I already found a code for functions.php that works ...
1
vote
1answer
108 views

Custom SQL query on wp_users with the addition of wp_usermeta

I am trying to query a list of user id's in WordPress using SQL IN() with the addition of them having a meta_value value of "Yes" on the meta_key "is_registered" in the wp_usermeta table but I can't ...
1
vote
1answer
119 views

How do I add custom fields data to a search index?

I need to make my listing data searchable: Specifically for Course Provider and Instructor. I haven't used meta queries before, anyone know where I can start? This is my current search form: Form:...
1
vote
0answers
38 views

How to sort by columns within a search result without displaying all rows again after sorting

I want to display a WP_List_Table on a submenu_page and offer a search function. The display of the data works so far and also the search, but the column sorting causes problems. If I click on the ...
1
vote
0answers
18 views

Rewrite: WordPress URL rewrite on Search

I am trying to create a URL rewrite in wordpress. I am creating a search from through wordpress. The URL structure I currently have is the following: http://localhost:8888/?post_type=CustomPost&s=...
1
vote
1answer
509 views

Custom post type not showing in search result

I have a custom post type that I would like to be searchable (I use the relevanssi search plugin). I have the following code to add the custom post type: add_action('init', 'eyewebz_create_post_types'...
1
vote
0answers
175 views

Extend product search with meta in WooCommerce

I would improve the search bar in order to exploit manufacture attribute linked to product. I try to use this to filter product by a custom meta (no product attribute) function custom_search_query( $...
1
vote
0answers
45 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 ...
1
vote
1answer
230 views

Include woocommerce custom field value in front-end search result

currently the search result only showing all the woocommerce default product field (product title, category, tag, .etc). I've add a new custom field inside the woocommerce product using this code ...
1
vote
0answers
90 views

WP Query Args - Title or Taxonomy Value

How do I query by tax_value or title? I have $args = array( '_meta_or_title' => sanitize_text_field(preg_replace('/%20/', '+', $query[1])), 'posts_per_page' => 100, 'post_type' =&...
1
vote
0answers
155 views

How to search by title or tags exclusively?

I would like to modify the default search query of Wordpress to be able to get results from searching exclusively by tags or title. Meaning, it would show posts that contains a match from either the ...
1
vote
0answers
20 views

Use “search” in permalink?

I am currently in the process of migrating a custom web app to WordPress and in the custom app, search requests have a URL structure of mydomain.com/search?q={search criteria}. I attempted to add ...
1
vote
0answers
146 views

How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?

I'm trying to include post meta in the scope of a WordPress search using WP_Query. I have a meta query that looks like this: $args['meta_query'] = [ 'relation' => 'AND', [ 'key' =...
1
vote
0answers
50 views

Save Search System

I am trying to create a save search notification system whereby a user can search certain parameters on my site and save the search query like Ebay does or other classified ad websites do. I ...
1
vote
0answers
73 views

Select posts by name and category per REST API

I have a site with a form, the form has 3 inputs. One takes a number, another a date, and another a select option. I made posts with categories from this select. How could I search on click of the ...
1
vote
0answers
24 views

Steps for custom data retrieval

I'm trying to create a data retrieval field within a page. This would be a single input text box, which would query a non-WordPress table and return the result. I have done custom retrieval in the ...