ID; $post_id = get_post($thePostID); $title = $post_id->post_title; $post_keys = array(); $post_val = array(); $post_keys = get_post_custom_keys($thePostID); if (!empty($post_keys)) { foreach ($post_keys as $pkey) { if ($pkey=='url1' || $pkey=='title_url' || $pkey=='url_title' || $pkey=='external') { $post_val = get_post_custom_values($pkey); } } if (empty($post_val)) { $link = $permalink; } else { $link = $post_val[0]; } } else { $link = $permalink; } return $link; } add_filter('the_permalink','cs_external_permalink'); add_filter('the_permalink_rss','cs_external_permalink'); ?>