我想在表单字段中为我的插件添加自定义分类中的自定义字段,并显示已保存的数据,如名称,slug和描述。 有人提出建议!
答案 0 :(得分:1)
function custom_column_header( $columns ){
$columns['address'] = 'Address';
$columns['phoneno'] = 'Phone No';
return $columns;
}
add_filter( "manage_edit-nwcm_news_category_columns", 'custom_column_header', 10);
//显示列值
function custom_column_content( $value, $column_name , $term){
if ($column_name === 'address') {
$t_id = $term;
$term_meta = get_option( "$t_id" );
print_r($term_meta['address']);
}
if ($column_name === 'phoneno') {
$t_id = $term;
$term_meta = get_option( "$t_id" );
print_r($term_meta['phone']);
}
}
add_action( "manage_nwcm_news_category_custom_column", 'custom_column_content', 10, 3);