Why isn't get_post_meta working?

后端 未结 9 1072
予麋鹿
予麋鹿 2020-12-12 05:12

Simple Wordpress problem - get_post_meta is not retrieving custom field values. Here\'s the code that is pulling from the custom fields:



        
9条回答
  •  天涯浪人
    2020-12-12 06:13

    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;
    

提交回复
热议问题