Admin Area Custom Type Search By Meta Fields Without Title & Content
There is a plugin called Search everything, where you can break down what you want to search. It does custom fields, posts and of course titles.
There is a plugin called Search everything, where you can break down what you want to search. It does custom fields, posts and of course titles.
Looks like this question is a several months old, but it’s a good one so I’m digging it out of the grave. The way I would go about solving it would be to intercept any searches with the pre_get_posts filter and add in the meta query based on the provided information. Here’s a basic shot … Read more
please never do this: ‘value’ => $_GET[‘s’] … $query->get(‘s’);, get_search_query, or sanitize_key($_GET[‘s’]) are all safer options. Technically we shouldn’t be using get-params in wordpress at all, it’s not a best-practice. That get value could be all sorts of bad things, & we don’t want to pass it along to the db without making sure it’s … Read more
To create your own independent search functionality, follow these steps. 1- You need a form to send the data for you. This is a simple form that can do this for you: <form method=”post” name=”car-select” action=”<?php echo site_url(‘/my-page/’); ?>”> <select name=”make”> <option value=”benz”>Benz</option> <option value=”bmw”>BMW</option> <option value=”audi”>Audi</option> </select> <select name=”type”> <option value=”sedan”>Sedan</option> <option value=”coupe”>Coupe</option> </select> … Read more
You could use a plugin like “Search Everything” which lets you toggle what to include in the search (including Custom Fields). Check it out here: http://wordpress.org/extend/plugins/search-everything/
This plugin called “WP Extended Search” looks like it would do the trick.: https://wordpress.org/plugins/wp-extended-search/ There’s also this answer that may work for you: Possible to search by author name with default WordPress search function?
You can replace the default WordPress search with something more useful. As you have pointed out, the build-in search is very limited. So you’re not the first one with this problem. I suggest the following two plugins: Search API (WordPress Plugin) WordPress Sphinx Search Plugin (WordPress Plugin) The last one allows to weight between parts … Read more
Considering @Mayeenul Islam comment: I’ve just tested in a blank theme with dummy data, search with 0 (zero) fired an empty search – that means all: SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type IN (‘post’, ‘page’, ‘attachment’) AND (wp_posts.post_status=”publish”) ORDER BY wp_posts.post_date DESC LIMIT 0, 10 and the fact that wp-includes/query.php contains if … Read more
Those are placeholders for % signs. If you’re sending % in the value to be compared against yourself, you’ll notice it transforming ‘%test%’ into wp_posts.post_title LIKE ‘{30d0e4b86a2a793010a75740f60810aff6b57f6d18edc10be7ca6dc158e40c06}\{30d0e4b86a2a793010a75740f60810aff6b57f6d18edc10be7ca6dc158e40c06}11{30d0e4b86a2a793010a75740f60810aff6b57f6d18edc10be7ca6dc158e40c06}\{30d0e4b86a2a793010a75740f60810aff6b57f6d18edc10be7ca6dc158e40c06}’ when you look at $query->request. The Query at the database side will have %. I haven’t looked into why exactly and where it is done, but I’ve noticed … Read more
The problem is that in a url the ‘+’ sign is equivalent to a space so that’s how PHP sees it. If you use an action on parse_request you can make this work like so: add_action( ‘parse_request’, ‘category_search_logic’, 11 ); function category_search_logic( $query ) { if ( ! isset( $query->query_vars[ ‘cat’ ] ) ) return … Read more