Try this: if ( ! function_exists( ‘customField’ ) ) : function customField($name, $id=false, $single=false){ global $post_type, $post; $name=trim($name); $prefix=”; // only if you need this $data=NULL; if($id!==false && !empty($id) && $id > 0) $getMeta=get_post_meta((int)$id, $prefix.$name, $single); else if(isset($post->ID) && $post->ID > 0) $getMeta=get_post_meta($post->ID,$prefix.$name, $single); else if(‘page’ == get_option( ‘show_on_front’ )) $getMeta=get_post_meta(get_option( ‘page_for_posts’ ),$prefix.$name, $single); else … Read more