Support

Account

Home Forums Feedback Description field on Admin page Reply To: Description field on Admin page

  • Hi,

    Because the fact it’s done by javascript, there isn’t really a way to easily do that in the javascript side. However, knowing how the javascript works, there’s actually easy way to trick it.

    The javascript is basically looking for the column ‘acf-fg-description’ and append the value after the title. So, if we can make the javascript unable to find “acf-fg-description’, then we can keep the description and title separated.

    Here’s some code you can try:

    
    <?php
    
    // acf's hook order is 10, so let make ours 15 to run after 
    add_filter('manage_edit-acf-field-group_columns', 'rename_field_group_column', 15, 1);
    add_action('manage_acf-field-group_posts_custom_column', 'renamed_field_group_column_value', 15, 2);
    
    // basically we just don't want the column 'acf-fg-description', so we rename it.
    function rename_field_group_column($columns) {
        $flipped = array_flip($columns);
        $flipped[__('Description', 'acf')] = 'acf-fg-description-custom';
    
        return array_flip($flipped);
    }
    
    // we check the renamed column here and print the description
    function renamed_field_group_column_value($column, $post_id) {
        $field_group = acf_get_field_group( $post_id );
    
        if ($column == 'acf-fg-description-custom' && $field_group['description']) {
            echo '<span class="acf-description">' . acf_esc_html($field_group['description']) . '</span>';
        }
    }
    

    Cheers. 😇