Home › Forums › Backend Issues (wp-admin) › How can I prevent ACF (or WordPress) from parsing and converting my shortcode to › Reply To: How can I prevent ACF (or WordPress) from parsing and converting my shortcode to
By default shortcodes in acf textareas are not rendered, so you’ve already got some filter in place.
I’ll asume that you use the filter 'acf/format_value/type=textarea'
If you use the do_shorctode
function or apply the_content
filter inside without restricting it to the frontend only, then your shortcodes would be rendered in the admin textarea fields as well.
To prevent this try to add the following restriction
if (is_admin()) {
return $value;
}
So your filter for acf textareas may look like this
function process_acf_textarea( $value, $post_id, $field ) {
if (is_admin()) {
return $value;
}
return do_shortcode($value);
}
add_filter('acf/load_value/type=textarea', 'process_acf_textarea', 10, 3);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.