Home › Forums › Front-end Issues › Execute shortcode on text area Instructions › Reply To: Execute shortcode on text area Instructions
Are you trying to make the shortcode work when editing the field in ACF or when someone else is editing a post and adding content to the field?
I tested this and it works perfectly on my test field named “some_shortcode” when I added [some_shortcode]
to the acf instuctions field.
add_filter('acf/prepare_field/name=some_shortcode', 'do_sortcode_in_field_instructions');
function do_sortcode_in_field_instructions($field) {
$field['instructions'] = do_shortcode($field['instructions']);
return $field;
}
add_shortcode('some_shortcode', 'do_some_shortcode');
function do_some_shortcode() {
return 'this is result from the shortcode';
}
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.