Title: Add enclosure
Last modified: August 20, 2016

---

# Add enclosure

 *  [MacGyver_](https://wordpress.org/support/users/macgyver_/)
 * (@macgyver_)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/add-enclosure/)
 * Can anyone explain this :
    I use a script to add posts and enclosures. The inserting
   posts works like a charme. Also adding other custom meta fielsds works however
   when i try to add an enclosure .. the meta field never shows up in the post.
 * Is there another way to “attach” an enclosure ?
 * $mypost_id = wp_insert_post( $my_post );
    add_post_meta( $mypost_id, ‘enclosure’,
   $encstring ); $encstring = $article[‘enclosure_url’] . “\n” . $article[‘enclosure_length’].“\
   n” . $article[‘enclosure_type’];

Viewing 1 replies (of 1 total)

 *  Thread Starter [MacGyver_](https://wordpress.org/support/users/macgyver_/)
 * (@macgyver_)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/add-enclosure/#post-2880836)
 * No one creates Enclosures using a RSS import script ??
 * Now i use another custom field to store the media-link.
    However : it belongs
   in the custom field “enclosure”. The script somehow does not allow the creation
   of the enclosures custom field in a post using an import-script

Viewing 1 replies (of 1 total)

The topic ‘Add enclosure’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 1 participant
 * Last reply from: [MacGyver_](https://wordpress.org/support/users/macgyver_/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/add-enclosure/#post-2880836)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
