# Descriptive ACF Flexible Content Layout Titles

> Shows each flexible content row's heading next to its layout name in the editor, so long pages built from sections are easy to scan.

- Type: PHP
- Runs: Admin only
- Category: [Custom Post Types & Fields](https://wpide.com/library/category/post-types/)
- Tags: acf, flexible-content, editor
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/acf-flexible-layout-titles/

## Code

```php
// Flexible content field name and the sub field shown in titles.
$wpide_acf_flex_field   = 'page_sections';
$wpide_acf_flex_heading = 'heading';

add_filter( 'acf/fields/flexible_content/layout_title/name=' . $wpide_acf_flex_field, function ( $title ) use ( $wpide_acf_flex_heading ) {
    $heading = function_exists( 'get_sub_field' ) ? get_sub_field( $wpide_acf_flex_heading ) : '';

    if ( is_string( $heading ) && '' !== trim( $heading ) ) {
        $title .= ' <span style="font-weight:400;opacity:.7">— ' . esc_html( wp_trim_words( $heading, 8 ) ) . '</span>';
    }

    return $title;
} );
```

## Notes

Set the flexible content field name and the sub field holding each section's heading. Needs ACF PRO.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Descriptive ACF Flexible Content Layout Titles" 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/
