WordPress.org

Ready to get started?Download WordPress

Forums

My Post Order
[resolved] Search Posts doesn't work (8 posts)

  1. Jeroendebeurs
    Member
    Posted 2 years ago #

    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/

  2. Kapil Chugh
    Member
    Plugin Author

    Posted 2 years ago #

    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!!

  3. Kapil Chugh
    Member
    Plugin Author

    Posted 1 year ago #

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

  4. Jeroendebeurs
    Member
    Posted 1 year ago #

    Great! Thanks!

  5. Jeroendebeurs
    Member
    Posted 1 year ago #

    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

  6. Kapil Chugh
    Member
    Plugin Author

    Posted 1 year ago #

    I think it happes by default 'post_type' => 'post', 'post_status' => 'publish'

    isn't?

  7. Jeroendebeurs
    Member
    Posted 1 year ago #

    No, not when you search, then you get all results (so also pages, not published posts and other post types).

  8. Kapil Chugh
    Member
    Plugin Author

    Posted 1 year ago #

    I have fixed this bug.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic