admin管理员组文章数量:1336281
This may be a repeat but it's the combination of things I can't find.
Custom post type is event
.
I have added an admin column 'Event Date' generated by ACF and it appears at the right. Everything appears fine in this order; 'Title', 'Venue', 'Date' 'Event Date'
I'd like to reorder it. So far so good, this code does that.
But the custom taxonomy 'venue' which has the slug venue
does not reappear (it appears but is not populated). How do I find out what the custom taxonomy is called for the purposes of the admin columns?
function reorder_event_columns( $columns ) {
$columns = array(
'cb' => $columns['cb'],
'title' => __( 'Title' ), // Post Title
'venue' => __( 'Venue'), // not populated!
'event_date' => __( 'Start Date'), // Appears fine
'date' => __('Date'), // Published Date
);
return $columns;
}
add_filter( 'manage_event_posts_columns', 'reorder_event_columns' );
This may be a repeat but it's the combination of things I can't find.
Custom post type is event
.
I have added an admin column 'Event Date' generated by ACF and it appears at the right. Everything appears fine in this order; 'Title', 'Venue', 'Date' 'Event Date'
I'd like to reorder it. So far so good, this code does that.
But the custom taxonomy 'venue' which has the slug venue
does not reappear (it appears but is not populated). How do I find out what the custom taxonomy is called for the purposes of the admin columns?
function reorder_event_columns( $columns ) {
$columns = array(
'cb' => $columns['cb'],
'title' => __( 'Title' ), // Post Title
'venue' => __( 'Venue'), // not populated!
'event_date' => __( 'Start Date'), // Appears fine
'date' => __('Date'), // Published Date
);
return $columns;
}
add_filter( 'manage_event_posts_columns', 'reorder_event_columns' );
Share
Improve this question
asked May 23, 2020 at 7:34
Chris PinkChris Pink
7321 gold badge6 silver badges21 bronze badges
1 Answer
Reset to default 1As ever, simple when you know.
Custom taxonomy columns in admin are called 'taxonomy-venue' if 'venue' is the taxonomy slug
So I now have my columns in the right order and even the custom taxonomy and acf sortable. Bliss.
本文标签: Reordering admin columns for CPT with custom taxonomy and an added custom field
版权声明:本文标题:Reordering admin columns for CPT with custom taxonomy and an added custom field 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742407073a2469039.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论