Linking text within textarea of custom meta box

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>.

Read More

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!

Related posts

Leave a Reply

1 comment

  1. 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.