Title: add_post_meta function not working properly
Last modified: August 20, 2016

---

# add_post_meta function not working properly

 *  [NicoBaez](https://wordpress.org/support/users/nicobaez/)
 * (@nicobaez)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/add_post_meta-function-not-working-properly/)
 * Hi, I have a WordPress blog that automatically catches a RSS feed, posts it and
   also sets a custom field with the help of the function [add_post_meta](http://codex.wordpress.org/Function_Reference/add_post_meta).
   This function is set on every post is created because I first get some info from
   the post and then create the custom field this way: `add_post_meta($id, 'key',
   $imageurl, true);` where `$id = get_the_ID();` and $imageurl is the url of an
   image in that post.
 * Everything happens in every post and the function is executed on every post individually.
   My problem is that once the custom tag is automatically set, I have to run (visit)
   the published post for it to work. If I do not enter the post, the custom tag
   would not be added.
 * How can this be possible. When the post is created, the custom field field should
   be created. When I enter the post, then the custom field is added.

The topic ‘add_post_meta function not working properly’ is closed to new replies.

## Tags

 * [functions](https://wordpress.org/support/topic-tag/functions/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [NicoBaez](https://wordpress.org/support/users/nicobaez/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/add_post_meta-function-not-working-properly/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
