Support » Plugins » Hacks » Add enclosures from Custom Field

  • I am working on a custom theme that uses custom post types. I have added a field to upload media and I want to run the do_enclose function on the post. But the post does not contain a link to the media in the post content, just in a custom field.
    Anyone care to offer a hack to the do_enclose function in wp-includes/functions that will look at a custom field rather than the post body?
    I would then run that function when a post with the custom post type was updated.

    Thanks in advance to anyone with the skilz to make this happen!

Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    It kind of looks like you can call do_enclose() passing your field value as $content. Failing that, you could write your own function to enclose the link.

    One problem would be if do_enclose() were called with the actual post content by some other process, your enclosure will be removed. Another approach would be to copy the field value to content as hidden text, then call do_enclose in the normal manner.

Viewing 1 replies (of 1 total)
  • The topic ‘Add enclosures from Custom Field’ is closed to new replies.