在 WordPress 管理员的自定义分类法中添加字段以保存数据
Add fields in custom taxonomy in WordPress admin for saved data
我想在表单字段中为我的插件添加自定义分类法中的自定义字段,并显示已保存的数据,如名称、别名和描述。
有人建议!
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);
我想在表单字段中为我的插件添加自定义分类法中的自定义字段,并显示已保存的数据,如名称、别名和描述。 有人建议!
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);