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'm using 'Meta Box Script for WordPress' to create custom meta boxes and everything is working great...except the following: We have a textarea that we want to act, basically as another WP the_content (It's for hidden content that is only shown once a link to show hidden content is clicked). My end-users want to be able to put something like the following in the box:

This is some pretty <a href="#">linked text</a>.

I'm using the following code in my template to show the custom meta box content:

<?php echo get_post_meta(get_the_ID(), 'oc_code', true); ?>

The content it shows is exactly like this (I'm guessing it's not parsing, if that's the correct phrase, the URL): This is some pretty <a href="#">linked text</a>.

What can I do to show a clickable href within the template without adding more custom fields/meta boxes? I was looking at esc_attr, esc_url, etc. but don't know that that is the solution.

TIA!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I finally found the answer to this and am posting it here in case someone else needs the answer. Just put the following in your theme file.

<?php

global $post;

$variable_name = get_post_meta($post->ID, 'custom_metaBox', true);

echo html_entity_decode( $variable_name );

?>

Change the variable name and custom_metaBox to your specific values and voila, functioning HTML code.

share|improve this answer

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.