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.

    Thread Starter Jeroendebeurs

    (@jeroendebeurs)

    Great! Thanks!

    Thread Starter Jeroendebeurs

    (@jeroendebeurs)

    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?

    Thread Starter Jeroendebeurs

    (@jeroendebeurs)

    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.