replacing + by – it’s possible?
]]>No longer works. All search results lead to a 404 page.
]]>Don’t know if the author is still monitoring this support page, however, for all of you out there using WPML plugin for multilanguage, I’ve added just two simple lines to make this plugin WPML compatible. So here is the modded code for function cws_nice_search_redirect
:
function cws_nice_search_redirect() {
global $wp_rewrite;
if ( !isset( $wp_rewrite ) || !is_object( $wp_rewrite ) || !$wp_rewrite->using_permalinks() )
return;
$search_base = $wp_rewrite->search_base;
if ( is_search() && !is_admin() && strpos( $_SERVER['REQUEST_URI'], "/{$search_base}/" ) === false ) {
if ( function_exists('icl_get_home_url') ){
wp_redirect( icl_get_home_url()."{$search_base}/" . urlencode( get_query_var( 's' ) ) ) ;
}else{
wp_redirect( home_url("/{$search_base}/" . urlencode( get_query_var( 's' ) ) ) );
}
exit();
}
}
]]>
After I added this plugin to my blog, when I’m searching the site. It gives me “This webpage has a redirect loop” error. Without this plug-in no issue.
Can someone please tell me how do I fix it?
]]>This solution is great but it does not have support for searching by post type (&post_type=xxx where x is the post name).
https://www.ads-software.com/extend/plugins/nice-search/
P.S.: I think this hack/solution should be in core when activating “nice” permalinks.
]]>i was using Nice Search and Search Fixer together (to beat this bug). now i have removed Search Fixer and all works fine with just Nice Search, the most comprehensive solution – thankyou.
]]>My previous search urls looked liked this:
https://example.com/?s=something+to+search+for
Now, after using Nice Search, they look like this:
https://example.com/search/something+to+search+for
However, the second page looks like this:
https://example.com/search/something+to+search+for/page/2/?s=something+to+search+for
Any ideas on why the search phrase is in the url twice?
]]>It does the redirect ok but shows no results. It goes to the home page (shows last posts like if no search was done) without any params.
127.0.0.1 - - [24/Jan/2012:00:41:53 -0200] "GET /?s=test HTTP/1.1" 302 -
127.0.0.1 - - [24/Jan/2012:00:41:54 -0200] "GET /search/test HTTP/1.1" 302 -
127.0.0.1 - - [24/Jan/2012:00:41:54 -0200] "GET / HTTP/1.1" 200 8669
It seems that the problem is with buddypress. Any one have any idea how to fix this?
]]>The plugin works perfectly if there are search results to display, but returns a completely blank page (white) when there are no results for the keyword.
]]>Hi
Just wondering if anyone could help.
Upon deactivation of this plugin, search results are shown on index.php with no search query parameters on the URL
My website is https://blurayaustralia.com/
If anyone knows how to fix this issue that would be great.
]]>I’m having the same request as Martin here: https://www.ads-software.com/support/topic/customise-the-search_base-prefix-?replies=9
I’m using the following code:
function cws_nice_search_redirect() {
if ( is_search() && strpos( $_SERVER['REQUEST_URI'], '/wp-admin/' ) === false && strpos( $_SERVER['REQUEST_URI'], '/search/' ) === false ) {
wp_redirect( home_url( '/search/' . str_replace( array( ' ', '%20' ), array( '+', '+' ), get_query_var( 's' ) ) .'/' ) );
exit();
}
}
add_action( 'template_redirect', 'cws_nice_search_redirect' );
in order to have a search permalink which looks like this:
https://www.mysite.com/search/search+term/
I’d like to change the term “search” with the italian term “ricerca” (https://www.mysite.com/ricerca/search+term/) but it doesn’t work.
Any suggestion?
]]>Added pagination, and a PERM redirect to avoid SEO problems.
Also removed the “+” from URL too.
function cws_nice_search_redirect() {
if ( is_search() && strpos( $_SERVER['REQUEST_URI'], '/wp-admin/' ) === false && strpos( $_SERVER['REQUEST_URI'], '/search/' ) === false ) {
$clean = str_replace( array( '+',' ', '%20' ), array( '-', '-', '-' ), get_query_var( 's' ) );
if(strpos( $_SERVER['REQUEST_URI'], '/page/' ) === false)
{
wp_redirect( home_url( '/search/' . $clean ), 301 );
exit();
}
else
{
wp_redirect( home_url( '/search/' . $clean ."/page/" . get_query_var( 'paged' ) ), 301 );
exit();
}
}
}
Thanks, nice job.
]]>Hi
I’ve just updated four sites from WordPress 3.0.5 to 3.1 (using SVN), and then updated Nice Search from 0.2 to 0.3 using the WordPress plugin upgrade functionality. I have experienced a similar issue on all of them:
After updating Nice Search, the version stays at 0.2, even though I have just updated, so WordPress says it still needs updating.
So I then update it again, and the version number correctly updates this time, but now the plugin is not activated, even though it was active before update, so I have to manually activate it.
I’ve not experienced this behaviour with other plugins on the same sites.
It’s not a major issue, but thought you may like to know about it.
Cheers
Simon