WordPress.org

Forums

Search Everything
[resolved] Exclude post_mime_type_image (3 posts)

  1. ogdendominic
    Member
    Posted 1 year 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 1 year 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 1 year 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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Search Everything
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic