• Hi there,

    I’ve encountered a strange bug where a custom field called “enclosure” added to a post (which contains an MP3 podcasting URL) is getting erased whenever the post is saved. The field seems to still be there after pressing “Save/Update” but when you return to the post after closing it, the custom field is completely gone.

    My client noticed this problem recently so I’m not sure when it started, but I haven’t made any changes to the site recently other than update some plug-ins, which I’ve ruled out as the culprit (see below for the reason.)

    I found one workaround that may provide a clue: if the custom field is simply added (using the button “Add custom field”) and the post is not re-saved afterwards, it does not get erased. So it seems like it’s definitely the act of saving that is causing the erasure. This workaround is not practical in the long term as occasionally my client needs to go back and edit the post, and the enclosure then gets erased and does not correctly appear in the podcast feed.

    I can add custom fields with any other name besides “enclosure” and they don’t get erased.

    I’ve tried turning off all plug-ins, but the problem persists.

    Two additional strange things:

    1) I noticed this Trac history which at first sounds related, but in my case the same MP3 URL is linked to in the post itself, so perhaps it’s not the same issue.

    2) I have the same site (same custom theme, plug-ins) running on my test server, and I do not have the enclosure erasing problem. I can edit posts there and the enclosure stays, as it should. Both test and live site are on the same server and running the same version of WP (3.3.1). I can’t think what the difference could be that might cause this issue.

    Thanks in advance for any ideas.

Viewing 15 replies - 1 through 15 (of 49 total)
  • Are you sure that field’s title is “enclosure” and not “_enclosure”? Any custom field whose title begins with an underscore is hidden from the Custom Fields display in Edit Page/Edit Post/

    Thanks, esmi. Absolutely – it’s enclosure – no underscore.

    It’s not just that the field gets erased from the WordPress admin area – unless that enclosure field is there, the audio interview does not get fed correctly to iTunes for podcasting purposes, so it’s a really serious glitch.

    All has been working fine for many years – so strange that this problem started all of a sudden.

    Have you checked in the database if the entry is there in the postmeta table? (if it’s either set or just empty)

    Sebastien – I see something like this when the enclosure is there:

    http://www.twitpic.com/8e17kc

    After saving the post that field disappears from phpMyAdmin completely.

    if your WordPress site didn’t change, maybe the hosting did. I’ve seen some crazy stuff happen when the host suddenly installs new mods for apache/php like suhosin.

    I would also try and rename the field to something like enclosure2 to see if the same information stays under a different name.

    Maybe I’m just shooting in the dark, this Is pretty weird…

    It might be worth testing this out in a local install to see if this “removal” is server specific.

    FWIW, just ran a test on my local server. Added a custom field called enclosure (value : testing) to a random post without any problem. No erasure.

    if your WordPress site didn’t change, maybe the hosting did. I’ve seen some crazy stuff happen when the host suddenly installs new mods for apache/php like suhosin.

    It might be worth testing this out in a local install to see if this “removal” is server specific.

    Hiya, thanks for both your ideas.

    I don’t think it’s a server issue since I have a test version of the same site (same theme, same plug-ins) running on the same server on a test domain – and there is no problem with custom fields getting erased on the test server!

    Sebastien – I’ve tested fields with all kinds of other names and they are not erased. I will now try enclosure2 for fun. πŸ˜‰

    p.s. it’s my own dedicated server and just for the record we haven’t made any changes on it lately.

    Further tests are still mystifying:

    – If I rename the field as enclosure2, it gets added OK, but the old enclosure field stays put too, even if I delete it

    – putting a word (rather than a URL) still causes the erasing problem

    Here’s the biggest weirdness to date. There are over 150 interviews in the system. I went back and spot-checked a half-dozen of them, and all stay OK after saving (i.e. enclosure is not erased) until the most recent few. And when I add a brand new one, the enclosure is also erased on saving.

    In phpmyadmin, if you search for all metas for a post with the erasure problem, are there more than one meta with the enclosure key?

    Only one enclosure meta in phpMyAdmin for posts with the issue. (I did a search for two.)

    Been giving this some thought… do you have any inactive plugins that could be using the same custom field title? enclosure is rather a generic title – which opens up the possibility of some sort of custom field name conflict.

    If you had a rogue plugin that also used enclosure as a custom field name but which updated its field by deleting and then setting up the record again (instead of updating) and fell over after the delete step, that would explain what is happening. I may be stating the obvious but a theme switch to Twenty Eleven and a plugin reset via the db would rule out or confirm any such conflict.

    Hi Esmi, Thanks for all the suggestions so far. Very appreciated. Interesting theory about the rogue plug-in. The only inactive plug-in on the live site was Viperbar, which I’ve just removed.

    I am really loathe to switch themes temporarily – this is a well-visited live site and I don’t want to risk anything further going awry during the process of switching and switching back. Same concern with resetting the plug-in database. I saw this plug-in – http://wordpress.org/extend/plugins/wordpress-reset/ – and it says it resets all plug-in values to defaults? This site has about a dozen well-configured plug-ins, I don’t think I can risk wiping out all their settings. Or maybe I’m misunderstanding what a plug-in reset does?

    If I can’t resolve this I’m going to have to start looking for a new audio plug-in. We’ve been using WP Audio to convert the audio links to an audio player but its development seems to have been abandoned in any case. See my earlier related thread: http://wordpress.org/support/topic/plugin-wpaudio-mp3-player-wp-audio-no-longer-adding-mp3-enclosures-as-custom-fields?replies=1

    I am really loathe to switch themes temporarily – this is a well-visited live site and I don’t want to risk anything further going awry during the process of switching and switching back.

    Can you replicate the basic setup in a dev/local install? Same active & inactive plugin(s), same theme?

Viewing 15 replies - 1 through 15 (of 49 total)
  • The topic ‘Enclosure Custom Field Erasing after Saving Post’ is closed to new replies.