Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 向cystom post类型添加类别_Wordpress - Fatal编程技术网

Wordpress 向cystom post类型添加类别

Wordpress 向cystom post类型添加类别,wordpress,Wordpress,我正在尝试为我在Wordpress安装中创建的自定义帖子类型添加类别 但它不会显示为该post类型下的选项。您添加了带有小写字母的自定义posttype register_post_type( 'programmering' , $args ); 在创建其类别时,您提到了大写字母 register_taxonomy( 'Programmering_category', 'Programmering', $args ); 即编程 试试这个 register_taxonomy( 'prog

我正在尝试为我在Wordpress安装中创建的自定义帖子类型添加类别


但它不会显示为该post类型下的选项。

您添加了带有小写字母的自定义posttype

register_post_type( 'programmering' , $args );
在创建其类别时,您提到了大写字母

 register_taxonomy( 'Programmering_category', 'Programmering', $args );
即编程

试试这个

 register_taxonomy( 'programmering_category', 'programmering', $args );

问题:在新帖子类型中创建类别时,我无法获取任何类别ID。var_dump(get_categories())生成一个空数组。发布一个新问题,并添加代码中遇到的所有信息和问题