'POST', 'callback' => 'afflc_redirect', ) ); } function afflc_redirect() { if(isset($_POST['id']) ) { $link = get_post_meta(intval($_POST['id']), 'button_link', 1 ); if($link != false && strlen($link) > 7) { header("Location: {$link}"); } else { header("Location: /"); } } die(); }