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. 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.