I am helping a buddy out and modifying his WordPress portfolio for him. I don’t use php
very often so this might be something simple.
In a template I am calling the WordPress the_field()
method like so:
<?php echo the_field('full_text'); ?>
This is outputting the content of the full_text
just fine however the full_text
does contain an <a>
tag which is not being generated as a link and is showing up as:
<a href="http://thelink.com">The Link</a>
instead of actually generating the link.
What do I need to do to get any HTML contained in the full_text
field to show up as HTML and not plain text?
Edit
In custom_fields.php
I’ve found:
array (
'key' => 'field_4',
'label' => 'Full Text',
'name' => 'full_text',
'type' => 'textarea',
'order_no' => 2,
'instructions' => 'Write about this item.',
'required' => 0,
'conditional_logic' =>
array (
'status' => 0,
'rules' =>
array (
0 =>
array (
'field' => 'null',
'operator' => '==',
'value' => '',
),
),
'allorany' => 'all',
),
'default_value' => '',
'formatting' => 'br',
),
It seems like you’re using Advanced Custom Fields. If so, you need to turn off the “filter content” setting to get the link to show up.
Thanks to mcrtr I was informed that the template he was using was using Advanced Custom Fields digging deeper I found the field
full_text
was of typetextarea
by changing it to wysiwyg it no longer outputted as plain text.When setting up the field, change the formatting option to
HTML
instead ofnone
and it’ll keep the<a>
tag around your link.You don’t need to change it to WYSIWYG in order to keep links as links in ACF.