I want to get a specific custom field value to display outside the wordpress loop in a new php page. right now im using the code below, which is doing what i want but in a ugly way. i need to exclude all custom fields except the one i want to get. instead of excluding, i would be happy if someone could provide me with a better code. so i can get just the custom field value that i want
require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-load.php');
$postid = $_GET["postid"];;
$custom = get_post_custom($postid);
foreach ($custom as $key => $value) {
if (($key != '_edit_lock' && $key != 'cwp_bar_icon' && $key != '_edit_last' && $key != 'send_onesignal_notification'&& $key != 'wp_noextrenallinks_mask_links'&& $key != 'wpb_post_views_count'&& $key != 'mp3'&& $key != 'wpb_post_views_count'&& $key != '_encloseme'&& $key != 'wpb_post_views_count'&& $key != '_pingme'&& $key != 'wpb_post_views_count'&& $key != '_is_video'&& $key != '_thumbnail_id'
))
echo '<meta http-equiv="refresh" content="0; URL=' . $value[0] . '">';
}