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

  • Resolved Jeroendebeurs

    (@jeroendebeurs)


    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/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Kapil Chugh

    (@kapilchugh)

    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

    (@kapilchugh)

    This bug has been resolved. Please update to latest version.

    Great! Thanks!

    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

    (@kapilchugh)

    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).

    Plugin Author Kapil Chugh

    (@kapilchugh)

    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.