You are right Jeroen.
Thank you so much for informing me.
It is a bug. I’m sorry, I didn’t check it.
Please give me time of 1-2 days so that I can fix it and upload the new version.
Thanks again!!
This bug has been resolved. Please update to latest version.
I made a small adjustment to your code, because with the search results I got posts which are not published and got all post types, so I changed this:
add_action( 'wp_ajax_search_posts', 'mpo_search_posts' );
function mpo_search_posts() {
$_POST = array_map( 'stripslashes_deep', $_POST );
$search_str = $_POST['search_str'];
$args = array('s' => $search_str);
require_once ('show_posts.php');
exit;
}
To this:
add_action( 'wp_ajax_search_posts', 'mpo_search_posts' );
function mpo_search_posts() {
$_POST = array_map( 'stripslashes_deep', $_POST );
$search_str = $_POST['search_str'];
$args = array('s' => $search_str, 'post_type' => 'post', 'post_status' => 'publish');
require_once ('show_posts.php');
exit;
}
[Moderator Note: Please post code or markup snippets between backticks or use the code button.]
Cheers,
Jeroen
I think it happes by default ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’
isn’t?
No, not when you search, then you get all results (so also pages, not published posts and other post types).