WordPress.org

Ready to get started?Download WordPress

Forums

Search Everything
Not Searching Attachments (5 posts)

  1. wrenchpilot
    Member
    Posted 2 years ago #

    Unable to get "Search Everything" to search attachment post types. Only displaying results for posts and pages. Option is enabled to search attachments, just not getting any search results.

    http://wordpress.org/extend/plugins/search-everything/

  2. wrenchpilot
    Member
    Posted 2 years ago #

    Apparently attachments now default to a 'post_status' of 'inherit'

    Fixed by changing line 358 to:
    $where = str_replace(" AND (post_status = 'publish'", " AND (post_status = 'publish' OR post_status = 'attachment' OR wp_posts.post_status = 'inherit'", $where);

    And line 363 to:
    $where = str_replace(" AND ($wpdb->posts.post_status = 'publish'", " AND ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'attachment' OR $wpdb->posts.post_status = 'inherit'", $where);

  3. alanna.scott
    Member
    Posted 2 years ago #

    thanks for this. super helpful!

  4. Workshopshed
    Member
    Posted 2 years ago #

    I also found this issue, my change was similar but I swapped the search criteria of post_status = 'attachment' with post_type = 'attachment'

  5. mgoi
    Member
    Posted 2 years ago #

    I tried amending the lines 397 and following as follows, but it still does not work I am afraid:

    $where = str_replace(" AND (post_status = 'publish'", " AND (post_status = 'publish' OR post_type = 'attachment' OR post_status = 'inherit'", $where);
    				$where = str_replace("AND post_type != 'attachment'","",$where);
    			}
    			else
    			{
    				$where = str_replace(" AND ($wpdb->posts.post_status = 'publish'", " AND ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_type = 'attachment' OR $wpdb->posts.post_status = 'inherit'", $where);

    Any leads appreciated.

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic