All Questions
35
questions
0
votes
0
answers
23
views
Search posts by meta key in admin and front
i want to search post by meta key and title. but when i use blow code search just meta key. how can i solve that?
function extend_admin_search( $query ) {
$post_type = 'post';
$custom_fields = ...
0
votes
0
answers
279
views
Extend search query to search meta keys values based on search string
I want to create an autocomplete AJAX search and I'm trying to have it where when the user starts typing, the list populates titles matching that search string.
My issue is in the WP_query, because I ...
0
votes
1
answer
92
views
Only show meta on one post type on search results page
I want to remove the post meta from all post types that are not "posts" from my site or at least from the search results.
Im currently using the Jnews theme and in the search results page I ...
0
votes
1
answer
2k
views
Modifying post content with the_post action hook
I'm trying to understand the best way to modify the way that search results are displayed with my custom post type. I've got the search function working properly and giving the correct results and now ...
1
vote
1
answer
360
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' =...
0
votes
1
answer
65
views
Sort by postmeta on when searching
I'm trying to sort by total_sales when searching, I have this till now but does not seem to do anything
add_action( 'pre_get_posts', function ( $q )
{
if ( !is_admin() // Target only front end ...
0
votes
1
answer
267
views
searching by keywords in post's metas or pagination links problem
i wanna create a custom search that will search posts by keyword not only in their titles and/or contents, but in post metas.
for example, from $wp_query->query_vars['s'] i got a word 'plastic' after ...
8
votes
2
answers
5k
views
WordPress database error: [Not unique table/alias: 'wp_postmeta']
Someone very kindly helped me out on another question, which has now lead to this problem of two functions causing a database error. From what I've read it could have something to do with LEFT JOIN ...
0
votes
2
answers
350
views
How to hide meta from search result only on pages?
I have different content on static pages and post in my WP site. On pages is not desirable to view meta in search result, but in my post is important.
Meta, I mean information about author, and date ...
1
vote
1
answer
2k
views
How can you include custom post meta in search without calling each key?
Looking at including the content from metaboxes in my search results but after researching I was only able to pick up two solutions:
How can I include meta box content when searching? Suggests using ...
0
votes
1
answer
140
views
custom search results - order results differently by post type
i've done a fair look round before posting this and i'm not getting much luck. Here's the scenario.
I have a search query which retrieves normal posts and two additional custom post types (...
0
votes
0
answers
149
views
search for single meta_key with numeric array of meta values
I was using a custom post let's say 'question' where user publishes the 'question' with a 'post meta' called 'course', in which multiple 'course names' stored as course id's(as a string separated with ...
2
votes
3
answers
4k
views
Custom search for custom post meta with pre_get_posts interferes with WP search
I'm making a custom post meta search with the pre_get_posts function in my Divi child theme functions.php file.
The problem is that the final query gathers not only the results for my custom post ...
0
votes
1
answer
81
views
Search one custom field?
In posts there is in custom field named "color". I have custom search page template, and I would like to show search results only from that one custom field. How to limit search to look just in one ...
2
votes
1
answer
6k
views
How do I add advanced custom fields / meta fields to Elasticsearch? [closed]
I am using the plugin ElasticPress. I'd like it to index some extra (advanced custom) fields. The only info I can find is this comment by one of the developers:
[...]if you would like to add ...