我建议使用默认的Wordpress register\\u Post\\u Type()创建一个新的Post类型。
function create_my_post_type() {
$labels = array(
\'name\' => __( \'Providers pricing\', \'myplugin_namespace\' ),
\'singular_name\' => __( \'Provider pricing\', \'myplugin_namespace\' ),
\'menu_name\' => __( \'Provider Pricing\', \'myplugin_namespace\' ),
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'description\' => __( \'Pricing stuff for my awesome plugin\', \'myplugin_namespace\' ),
\'show_in_menu\' => true,
\'supports\' => array( \'title\', \'thumbnail\' ), // or whatever else you want from WP_Post
\'has_archive\' => true,
);
}
需要明确的是:这应该在插件启动期间运行。要为字段添加自定义元框,请阅读函数
add_meta_box()