WordPress.org

Ready to get started?Download WordPress

Forums

Search Everything
[resolved] Exclude post_mime_type_image (3 posts)

  1. ogdendominic
    Member
    Posted 6 months ago #

    Hi there,
    Really useful plugin but I was wondering if in a future update instead of search all "attachments" file we could just want PDF results. I'm facing this problem right now of having .jpg files in my results and I only want .DOC and .PDF results.
    Thanks.

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

  2. ogdendominic
    Member
    Posted 6 months ago #

    It seems I have found it in the function se_search_attachments :

    function se_search_attachments( $where ) {
    		global $wpdb;
    		if ( !empty( $this->query_instance->query_vars['s'] ) ) {
    
    			$where = str_replace( '"', '\'', $where );
    			if ( !$this->wp_ver28 ) {
    				$where = str_replace( " AND (post_status = 'publish'", " AND (post_status = 'publish' OR post_type != 'attachment'", $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' <strong>OR $wpdb->posts.post_mime_type = 'application/pdf' OR $wpdb->posts.post_mime_type = 'application/msword'</strong> ", $where );
    				$where = str_replace( "AND $wpdb->posts.post_type != 'attachment'", "", $where );
    			}
    		}
    		$this->se_log( "attachments where: ".$where );
    		return $where;
    	}

    it would be so great to have an option like "Include/Exclude post_mime pdf or word or image " instead of me manually editing it

  3. silvoslaf
    Member
    Plugin Author

    Posted 4 months ago #

    Hope you don't mind, but since this topic is now older than 2 months, we are going to mark it as 'resolved'.

    If you find yourself with any other questions or if there's anything that's not completely clear, do let us know, since we'll gladly help!

    Take care & have a nice day!

    Best,
    Silvo

Reply

You must log in to post.

About this Plugin

About this Topic