Add spacebar in WP List Table Search
I would like to add spacebar %20 or + on the redirect URL in the search, how can I do that with the add_query_arg?
function bulk_search() {
$redirect_to = add_query_arg( array( 's' => $_POST['s'] ), $_POST['_wp_http_referer']);
wp_redirect( $redirect_to );
exit();
}
With the function above, if in the search box I keyed in "Hello World" it would return the search with &s=helloworld on the URL instead of &s=hello+world
Thank you in advance.
Solutions
function bulk_search() {
$redirect_to = add_query_arg( array( 's' => urlencode($_POST['s']) ), $_POST['_wp_http_referer']);
wp_redirect( $redirect_to );
exit();
}
Realised by adding urlencode() function would do.
Similar questions
Wordpress bulk trash action using table inherited from WP Posts List Table
In a plugin which shows a table of posts of a custom type, I wanted to add the option for bulk actions. Besides the checkboxes I displayed the control for bulk actions, but when I click Apply, nothing happens. It's supposed to be an action, I guess, but I couldn't find which one. I tried trash_post, but it doesn't get hit. How do I perform a bulk d...
MySQL: Return list of values in one table conditional on another table
I need to create a view of student ID numbers that are active (paying) members. Student numbers are stored in a table called usermeta like so: Whether the person is a member is stored in the posts table (Woocommerce/Wordpress setup...): user_id and post_author are the unique IDs identifying each member/user. I know I can return a list of ID numbers...
Search: how to extend the existing search to include a custom table
I created a custom table 'products' with the following field:title,description,url.The items stored into the table are imported. I would like to extends the wordpress search to this table. Is it possible to do this?
WP search function to search custom table
Now here's something I can't even find on google. Does anyone here know how I can change the search function in wordpress to search only inside one custom table with a few fields? I've been wrecking my brain over this. I can't even find a plugin that lets you define your own table and fields in the db. Can anyone help? (by the way I think that migh...
Search uses index.php instead of search.php on renaming search field from "s"
I am building a custom search form which has multiple search boxes and I rename them to "searchbox1" from "s". Now WP does not use search.php; instead the code is execured from index.php. How can I make it to use search.php?
Can I change the default search behavior "OR search" to "AND search"?
For example, if I search the site with the following parameters. http://localhost/?s=KEYWORD&tag[]=TAG1&tag[]=TAG2 This is like saying that Posts where [keyword is 'KEYWORD'] OR [has 'TAG1' tag] OR [has 'TAG2' tag]. So this is an "OR search", I don't want that, I want "AND search". How can I change this default behavior??