Hello all,
I'm in the final stages of wrapping up a big theme project for a client, and one of the things they've asked me to integrated is a link cloaker. I found the "Affiliate hide" plugin but I've been tweaking it so it pulls from a specific custom field.
The main function of the plugin is as follows:
PHP Code:
function affiliate_hide() {
global $wp_query;
if( isset( $wp_query->query_vars['go'] )) {
$target = get_post_meta($wp_query->query_vars['go'], 'url', true);
if($target == '') {
wp_redirect(get_option('siteurl')); exit; // if no blog post redirects to index page.
}
wp_redirect($target, 301);
exit;
}
}
The 'url' is referring to the custom field in which the link to be cloaked is found. My problem is that I followed this
add meta box tutorial to utilize custom fields in a much nicer interface for my clients clients. This particular tutorials stores everything in an array, so I typically access values like so:
PHP Code:
$my_meta = get_post_meta($post->ID,'_my_meta',TRUE);
echo $my_meta['link'];
my problem is being able to grab the 'link' in place of the 'url' in the plugin function. I've tried a wide variety of things but just can't seem to figure it out.
Any help would be appreciated.
Thank you!