Simple Wordpress problem - get_post_meta is not retrieving custom field values. Here\'s the code that is pulling from the custom fields:
<?php get_post_meta(get_the_id(), 'YOURKEY', true) instead of get_post_meta($post->ID, 'YOURKEY', true) ?>
Works for me!
Its because of auto save. use these lines for preventing auto save and user privileges.
// Bail if we're doing an auto save
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
// if our current user can't edit this post, bail
if( !current_user_can( 'edit_post' ) ) return;
You could also use get_post_meta( $loop->post->ID, 'yourkey', true ); if you are using $loop = new WP_Query( $args ); or something similar.