New Landing How can we help? Themeforest Theme Support Dante Exclude media from search

Viewing 8 posts - 1 through 8 (of 8 total)
  • Posted in: Dante
  • #141047
    wochurch
    Member
    Post count: 55

    Is it possible to exclude certain items from the search? We have MP3s behind a password page for our teams that we don’t want to be available publicly. Thanks.

    #141126
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    Can you provide admin access and a link to the mp3 page?

    Guess you are just including the mp3 has attachment or you have any additional plugin to handle the mp3?

    -Rui

    #141169
    wochurch
    Member
    Post count: 55
    This reply has been marked as private.
    #141178
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Thanks. Just forgot to ask you for an search term example.

    Remember that one thing is not to appear attachments in the search(mp3, images, etc) other totally different is to exclude pages that contain mp3 files.

    -Rui

    #141192
    wochurch
    Member
    Post count: 55

    If you search “Kari Jobe”, you’ll see the page we have up for her, and you’ll also see an MP3 that we hope we could exclude.

    I think it would be a perfect solution if I could exclude all attachments from showing up. Is that possible? I have a plugin that will exclude pages that I think is working well.

    #141213
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Nope, those results are not from the custom post type attachment.

    I tried this code below but it’s only for attachment not pages or other types of custom post types that have mp3 inside.

    
    add_action( 'init', 'exclude_from_search' );
     
    function exclude_from_search() {
      global $wp_post_types;
      
      /* Exclude 'attachment' post type. */
      $wp_post_types['attachment']->exclude_from_search = true;
    }

    Not sure if you already tried S2Member is a great plugin to restrict content.
    Unfortunately there no much more we can do for you on this one.

    -Rui

    #141547
    wochurch
    Member
    Post count: 55

    So that code will exclude all attachments from showing up in the search results? I think that will solve our problem. Where do I put that code?

    #141554
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    I added the code to the functions.php, but has I said I tried that code but the results using the terms you provided me were still the same.

    The problem is to exclude pages that have mp3 inside.

    -Rui

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register