Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to put a link in the post meta with this code

$authorEmail = get_the_author_meta('user_email');
$authorEmailLink = '<a href ="mailto:'.$authorEmail.'">'.$authorEmail.'</a>';
add_post_meta($post->ID,'Author Email',$authorEmailLink,true);

The $authorEmailLink is a valid link because I can echo it to the page. However, when I put it on the page, it just displays the plain text email. Is there something I am not doing or a way to get around this?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I don't think spaces are allowed in $meta_key. Try to change 'Author Email' to 'author_email'.

Also, if you don't want 'author_email' to be visible in Custom Fields metabox, prepend it with underscore: '_author_email'. Unfiltered link as custom field value can also mess this metabox.

share|improve this answer
    
Thanks for your help, Max. –  fdsa Jun 20 '12 at 20:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.