WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to exclude files from showing in rss feeds? (4 posts)

  1. dasfgh
    Member
    Posted 1 year ago #

    When I checked the feed channel of my site, I noticed that below the post excerpts there's a download link to the media files (e.g. mp3's, videos) which are attached to the post. How can I hide them or exclude them from appearing into the feeds? Thank you.

  2. dasfgh
    Member
    Posted 1 year ago #

    the problem is obviously the custom field automatic enclosure. i try to remove it manually but it comes back by itself. I found a code which maybe can solve the problem, I just don't know where to put it (it should be in functions.php but where exactly?)

    function delete_enclosure(){
    return '';
    }
    add_filter( 'get_enclosed', 'delete_enclosure' );
    add_filter( 'rss_enclosure', 'delete_enclosure' );
    add_filter( 'atom_enclosure', 'delete_enclosure' );
  3. dasfgh
    Member
    Posted 1 year ago #

    I found it. I deleted the "enclosure" custom fields below the post and I leave it without saving the changes and it goes away.

    If you save, wordpress will detect the attached media again and will bring back the "enclosure" custom field automatically.

    I also added the no more enclosures plugin:
    http://wordpress.org/extend/plugins/no-more-enclosures/

    I hope it will prevent the creation of enclosures in the future, as it is said on it's page

  4. dasfgh
    Member
    Posted 1 year ago #

    i published a new post with a video file attached in it and the enclosure custom field appeared again. the plugin didn't prevent it.
    I deleted the custom field, it didn't help. Finally, I turned off pinging under the post and the video file disappeared from the feeds

Topic Closed

This topic has been closed to new replies.

About this Topic