Title: [Plugin: My Post Order] Search Posts doesn&#039;t work
Last modified: August 20, 2016

---

# [Plugin: My Post Order] Search Posts doesn't work

 *  Resolved [Jeroendebeurs](https://wordpress.org/support/users/jeroendebeurs/)
 * (@jeroendebeurs)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-my-post-order-search-posts-doesnt-work/)
 * Hi Kapil Chugh,
 * Great plugin, this was exactly what I was looking for and saved me a lot of programming.
   However when adding posts to a selection, the search function doesn’t seem to
   work. When I search on an excisting posttitle and press search I get a window
   with “Please enter search text”. Any ideas?
 * Cheers,
    Jeroen
 * [http://wordpress.org/extend/plugins/my-posts-order/](http://wordpress.org/extend/plugins/my-posts-order/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Kapil Chugh](https://wordpress.org/support/users/kapilchugh/)
 * (@kapilchugh)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-my-post-order-search-posts-doesnt-work/#post-2694792)
 * 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!!
 *  Plugin Author [Kapil Chugh](https://wordpress.org/support/users/kapilchugh/)
 * (@kapilchugh)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-my-post-order-search-posts-doesnt-work/#post-2695058)
 * This bug has been resolved. Please update to latest version.
 *  Thread Starter [Jeroendebeurs](https://wordpress.org/support/users/jeroendebeurs/)
 * (@jeroendebeurs)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-my-post-order-search-posts-doesnt-work/#post-2695096)
 * Great! Thanks!
 *  Thread Starter [Jeroendebeurs](https://wordpress.org/support/users/jeroendebeurs/)
 * (@jeroendebeurs)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-my-post-order-search-posts-doesnt-work/#post-2695099)
 * 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
 *  Plugin Author [Kapil Chugh](https://wordpress.org/support/users/kapilchugh/)
 * (@kapilchugh)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-my-post-order-search-posts-doesnt-work/#post-2695100)
 * I think it happes by default ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’
 * isn’t?
 *  Thread Starter [Jeroendebeurs](https://wordpress.org/support/users/jeroendebeurs/)
 * (@jeroendebeurs)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-my-post-order-search-posts-doesnt-work/#post-2695104)
 * No, not when you search, then you get all results (so also pages, not published
   posts and other post types).
 *  Plugin Author [Kapil Chugh](https://wordpress.org/support/users/kapilchugh/)
 * (@kapilchugh)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-my-post-order-search-posts-doesnt-work/#post-2695197)
 * I have fixed this bug.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘[Plugin: My Post Order] Search Posts doesn't work’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/my-posts-order_8e9dad.svg)
 * [My Post Order](https://wordpress.org/plugins/my-posts-order/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/my-posts-order/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/my-posts-order/)
 * [Active Topics](https://wordpress.org/support/plugin/my-posts-order/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/my-posts-order/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/my-posts-order/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Kapil Chugh](https://wordpress.org/support/users/kapilchugh/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-my-post-order-search-posts-doesnt-work/#post-2695197)
 * Status: resolved