# Run Shortcodes Inside ACF Text Fields

> Lets editors use shortcodes in ACF text and text area fields, which ACF otherwise prints as plain text.

- Type: PHP
- Runs: Frontend only
- Category: [Custom Post Types & Fields](https://wpide.com/library/category/post-types/)
- Tags: acf, shortcode, fields
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/acf-shortcodes-in-text-fields/

## Code

```php
$wpide_acf_do_shortcodes = function ( $value ) {
    return ( is_string( $value ) && false !== strpos( $value, '[' ) ) ? do_shortcode( $value ) : $value;
};

add_filter( 'acf/format_value/type=text', $wpide_acf_do_shortcodes, 20 );
add_filter( 'acf/format_value/type=textarea', $wpide_acf_do_shortcodes, 20 );
```

## Notes

WYSIWYG fields already run shortcodes. Only use this if you trust everyone who can edit fields.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Run Shortcodes Inside ACF Text Fields" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
