Search suggestions only appear when user is logged in. Any suggestions
]]>wp-search-suggest.php: 86
You pass a callback-function name as 'ajax_response'
instead 'wpss_ajax_response'
for unauthorizated users ??
add_action( 'wp_ajax_nopriv_wp-search-suggest', 'ajax_response' );
Correct:add_action( 'wp_ajax_nopriv_wp-search-suggest', 'wpss_ajax_response' );
Is it possible to take shop search results?
I am still waiting the answer to my older post about mobile searches with my theme ??
As you see I still love your plugin but it doesn’t work on mobile phones ??
Any Idea?
]]>I’ve just today updated the plugin to version 7 but it seems to have broken. When I enter search text it’s just giving me one single suggestion of ‘0’ and nothing else. Any suggestions?
Our site is only using PHP 7.4 at the moment.
(FYI I’ve rolled back to version 6 for the time being as can’t afford for it not to work)
]]>After php 8 not working again. It was a case one time.
I also don’t like search results from my shop
Doesn’t work with bpbold theme?
On my another site (other theme) is still working.
Hi!
Thank you for a nice and simple plugin.
Would you make some effort to make it WPML compatible?
Unfortunately, currently the suggestions are not current-language-scoped and the permalink of returned object is always from the base language (that’s how get_permalink(ID) works in WPML).
I’m cracking with it for my project, but maybe you can provide the solution within the plugin so it could benefit from that.
]]>Hi!
I use W3TC Plugin with long caching time (> 24 hours).
The method init() creates local script with ‘_wpnonce’ for all: logged in and NON logged in users.
For this reason after ~ 24 hours WP Search Suggest returns 403 error: on caching page wpnonce is timed out.
—
I temporarily solved the problem by adding the is_user_logged_in() condition to the ajax_response() and post_url () methods (for check_ajax_referer()), but this is a BAD solution. I think it would be better to change the code of the init() method and add the ‘_wpnonce’ key only for authorized users.
I have a multi-author local site where posts and pages do come and go (created/deleted). When clicking on the suggested search topics from the search bar, it will direct you to a Page 404 Error. Whereas, the page is actually published.
I really appreciate any help. Thank you!
]]>Hi, I would be grateful if someone can help me showing the category of the post along with its title. This is because I have posts in different categories with the same title, so when I search for a term, let’s say “Chaplin”, the live search suggests me “Charlie Chaplin” let’s say twice, but I don’t know which categories they belong to. I’d like to have search suggestions like “Charlie Chaplin (Directors)” and “Charlie Chaplin (Actors)”, where obviously Directors and Actors are the name of categories. I think it’s something related to this line in wp-search-suggest.php:
$results = apply_filters( 'wpss_search_results', wp_list_pluck( $query->posts, 'post_title' ), $query );
but I don’t know how to change “post_title” with the thing I want to show.
Thanks a lot.
Fede
PHP Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in:
wp-content/plugins/wp-search-suggest/wp-search-suggest.php on line 121
]]>Hi,
Is it possible to set different args with the wpss_search_query_args filter for a specific post type archive template (for example archive-portfolio.php)? I would like to show the search results on a post type archive template for only that specific post type.
Thank you,
With kind regards,
Patrick Heiloo | We Brand Creative
Lead Developer
Hi @obenland,
I’m wondering for the reason why wp_reset_postdata() is not being used like so:
$query = new WP_Query( $query_args );
if ( $query->posts ) {
$results = apply_filters( 'wpss_search_results', wp_list_pluck( $query->posts, 'post_title' ), $query );
echo wp_kses_post( join( $results, "\n" ) );
wp_reset_postdata();
}
wp_die();
Is it because it’s a ajax call? or because the WP_Query is not being modified? or..?
Thanks!
]]>Hi,
Search suggestions work with default WordPress search, but not the responsive menu search. COuld you help solve this?
]]>Or are modifications needed? So far there is no auto-suggest for any of my custom post types.
Thanks.
]]>After implementing the plugin , everything i working fine in desktop view but when checked on mobile view the search results text is going out of the box, it is not visibly fully.
So can you tell where i can modify to make it responsive.
Hi,
I need to customize the plugin to show suggestions only based on page/post title.
Also, I would like to show search results page rather than the post link. In Certain cases the links are wrong.
Are there configurations/hooks available, rather than modifying the base plugin code.
]]>Whenever clicking on any result shown from the suggestions , wrong link is opened for the post. The link which is opened /uncategorized/48531-autosave-v1/
, while 48531 is the post id.
i have 2 searches on my site. one to search blogs
https://sovrnknowledge.staging.wpengine.com/blog/
and another to search support articles
https://sovrnknowledge.staging.wpengine.com/support/
i am specifying post type to search via
<input type=”hidden” name=”post_type” value=”support”>
the search themselves work as expected. how do i use
wpss_search_query_args to limit each search suggestion to only be post on the blog search and support on the support search?
I think all is in the title :-).
How to achieve this behaviour ?
]]>The plugin requires the form’s ID to be “searchform”. However, when themes support HTML5, WordPress doesn’t give search forms that ID. (You can see the code on lines 209-210 of wp-includes\general-template.php
):
if ( 'html5' == $format ) {
$form = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '">
If WP Search Suggest could support that form in addition to the HTML4 form, it would make life much easier for those of us running HTML5 themes.
Thanks
]]>Any chance of getting Relevanssi support for the plugin?
It’d be fairly simple. In the ajax_response()
function, just pass the query to Relevanssi:
$query = new WP_Query( $query_args );
if ( function_exists( 'relevanssi_do_query' ) ) {
relevanssi_do_query( $query );
}
That’s it.
]]>Still 5 Stars Plugin but my thumbnails have due to problems sometimes -1 or -2 in title slugs.
And this media files will be shown in suggestions as founded post.
How can I avoid this.
Want plugin only to search posts titles not media files, never ??
thanks in advance
]]>In ‘/wp-content/’ folder create another folder: ‘mu-plugins’ (if does’n exists; ‘mu’ – must use).
In ‘/wp-content/mu-plugins/’ create file, ex.:
disable_plugins_when_wp_search_suggest.php
Add code into ‘disable_plugins_when_wp_search_suggest.php’:
<?php
if ( ! function_exists('disable_plugins_when_wp_search_suggest') ) {
add_filter( 'option_active_plugins', 'disable_plugins_when_wp_search_suggest' );
function disable_plugins_when_wp_search_suggest( $active_plugins ) {
$uri = 'action=wp-search-suggest';
if ( false !== strpos( $_SERVER['REQUEST_URI'], $uri) ) {
$for_enable = 'wp-search-suggest/wp-search-suggest.php';
$index = array_search($for_enable, $active_plugins);
foreach( $active_plugins as $idx => $plugin ) {
if ( $index !== array_search( $plugin, $active_plugins) ) {
unset($active_plugins[$idx]);
}
}
}
return $active_plugins;
}
}
?>
Now all active plugins will not be loaded during the search except WP Search Suggest and server response time will be reduced by several times (from 1.5 seconds to 200 milliseconds with 30 active plugins for me).
]]>I’ve got several posts with symbols in the title (specifically a !) and when those popup in the search results and you click on a title you get the incorrect value in the URL. For example for a post name “PASS Summit Speaker Idol 2016 Is a Go!” it should use the slug “pass-summit-speaker-idol-2016-is-a-go” but it uses the slug “9021-revision-v1” instead.
]]>Hi
is there any way to order suggested result in drop down suppose i write “test” in search box suppose they display 5 result so that same order i need on result page when i click on any of them.
is there any quick solution ?
Thanks
Hi there,
I have another suggestion/question for your plugin wp-search-suggestion.
Where you localize the JS, you pass parameters to the wp ajax handler:
wp_localize_script( $this->textdomain, 'wpss_options', array(
'url' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'wpss-post-url' ),
'ajaxurl' => add_query_arg( array(
'action' => $this->textdomain,
'_wpnonce' => wp_create_nonce( $this->textdomain ),
'l' => get_my_lang(),
), admin_url( 'admin-ajax.php' ) ),
) );
As you might recognize, I have patched this with 'l' => get_my_lang()
so the wp_query knows about the correct language for the post titles it will suggest.
Now patching stranger’s plugins is never good, so my question is: maybe you can add a mechanism to pass through any $_GET values?
Thanks!
]]>Hey,
I will also post this here, since it is your plugin I have changed for what I wanted to realize.
First, thanks for your plugin. The interface is so simple yet exactly what I was looking for, and very snappy.
My problem was, I rely heavily on custom fields. Thus, I use the plugin “Search Everything” to replace the original wordpress search. However, at one point where you use WP_Query the original, weaker search is used again. I bypassed the problem by copying a passage from that other plugin into yours, adapting it slightly.
Maybe you have an idea how there two plugins can work together without such a form of modification.
Thank you!
public function ajax_response() {
check_ajax_referer( $this->textdomain );
$s = trim( stripslashes( $_GET['q'] ) );
$query_args = apply_filters( 'wpss_search_query_args', array(
's' => $s,
'post_status' => 'publish',
), $s );
// The modified part starts
$is_query = !empty($s);
$result = array();
if ($is_query) {
$result = array(
'own' => array(),
'external' => array()
);
$params = array(
's' => $s
);
$zemanta_response = se_api(array(
'method' => 'zemanta.suggest',
'return_images' => 0,
'return_rich_objects' => 0,
'return_articles' => 1,
'return_markup' => 0,
'return_rdf_links' => 0,
'return_keywords' => 0,
'careful_pc' => 1,
'interface' => 'wordpress-se',
'format' => 'json',
'emphasis' => $_GET['s'],
'text' => $_GET['text']
));
if (!is_wp_error($zemanta_response) && $zemanta_response['response']['code'] == 200) {
$result['external'] = json_decode($zemanta_response['body'])->articles;
}
$SE = new SearchEverything(true);
if (!empty($_GET['exact'])) {
$params['exact'] = true;
}
$params["showposts"] = 5;
$post_query = new WP_query($params);
$results = array();
if ( $post_query->posts ) {
$results = apply_filters( 'wpss_search_results', wp_list_pluck( $post_query->posts, 'post_title' ), $post_query );
echo join( $results, "\n" );
}
}
wp_die();
// Your original again, though inactive after wp_die()
$query = new WP_Query( $query_args );
if ( $query->posts ) {
$results = apply_filters( 'wpss_search_results', wp_list_pluck( $query->posts, 'post_title' ), $query );
echo join( $results, "\n" );
}
wp_die();
}
]]>
Wp Search Suggest plugin is working on my local machine with the small changes in form id and input id but when i did same changes on live/server the plugin didn’t work. I am using compare theme on my site. Is there any other changes that i need to do.
]]>