Support

Account

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);