How to Stop WordPress from Enclosing MP3s in Posts

Occasionally there may be a time when you really don’t want to publish all the MP3s of a post in your RSS feed. Unfortunately WordPress will not allow you to remove an MP3 it’s linked to. To be more accurate WordPress will always link to all available media files every time you press *Save.*

This becomes a huge issue when you are recording a podcast and linking to various MP3s you might have played during the course of a show. However with the addition of one letter to one line on one page of your WordPress installation you too can be enclosure free… and by free, I mean you will from this point on never have WordPress enclosing files even if you want them. You may of course manually enclose files, but this may problematic for some people.

# Find the folder in your WordPress Installation named *wp-includes*
# open the file in that folder named *functions.php*
# Scroll down to line 766 which starts preg_match_all and edit the bit that should have *http* and make it now read *httpp*
# Save the file and upload to your server.

*What did I just do?* Well, in effect you have told WordPress only to enclose files which start with httpp://www.yaddayadda…… and since no link can ever be on a server that starts httpp it will never include a file.

*It’s ugly, but it works.*

p(note). This hack has been tested with WordPress 1.5.x Please be cautious of modifying your WordPress code and always have a backup in the wings. I take no responsibility for broken sites.

3 Comments

Comments are now closed.