You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WordPress与ACF管理:后台自定义列添加位置列需求

How to Add a "Position" Column to ACF Field Group List in WordPress Admin

Got it, let's solve this! You've already extended the ACF field group list with an "Order" column using acf_field_group_columns, and now you want to add a Position column that clearly shows where each field group appears on the post edit screen—like "After Title", "Normal" (main content area), or "Sidebar".

Here's the complete, step-by-step implementation:

1. Extend the Columns Array

First, update your existing acf_field_group_columns function to add the new "Position" column to the columns list:

function acf_field_group_columns($columns) {
    // Keep your existing "Order" column
    $columns['menu_order'] = __('Order');
    
    // Add the new "Position" column
    $columns['position'] = __('Position');
    
    return $columns;
}
add_filter('acf/field_group/admin_columns', 'acf_field_group_columns');

2. Populate the Position Column Content

Next, use ACF's acf/field_group/admin_column_content hook to fill the column with human-readable position labels. ACF stores field group positions as raw values (acf_after_title, normal, side), so we'll map those to friendly names:

function my_acf_field_group_position_column($content, $field_group) {
    // Map ACF's raw position values to user-friendly labels
    switch ($field_group['position']) {
        case 'acf_after_title':
            return __('After Title');
        case 'normal':
            return __('Normal (Main Content Area)');
        case 'side':
            return __('Sidebar');
        default:
            return __('Unknown Position');
    }
}
add_action('acf/field_group/admin_column_content/name=position', 'my_acf_field_group_position_column', 10, 2);

How This Works

  • The acf/field_group/admin_columns filter lets you modify the columns shown on the ACF field groups list page.
  • The acf/field_group/admin_column_content/name=position action targets the specific "position" column we added, and passes the $field_group object so we can access its position data.
  • We use a switch statement to convert ACF's internal position values into labels that make sense for site managers.

Just drop both functions into your theme's functions.php file, or a custom plugin, and you'll see the new Position column in your ACF field group list immediately!

内容的提问来源于stack exchange,提问作者morgyface

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 10:17:29