自定义开机自检类型未显示在管理菜单中

时间:2018-04-08 作者:ejoo

我制作了四种自定义的帖子类型。我不明白为什么第四个没有出现在管理菜单中。

她的密码是:

drx\\U服务。php:

    add_action( \'init\', \'drx_services_post_type\' );
    function drx_services_post_type() {
        register_post_type( \'drx_services\',
            array (
                \'labels\' => array (
                    \'name\' => __( \'Service-Angebote\' ),
                    \'singular_name\' => __( \'Service-Angebot\' )
                ),
                \'taxonomies\' => array (\'post_tag\', \'category\'),
                \'public\' => true,
                \'menu_icon\' => \'dashicons-hammer\',
                \'has_archive\' => true,
                \'supports\' => array ( \'title\', \'editor\', \'thumbnail\', \'excerpt\' ),
                \'rewrite\' => array (\'slug\' => \'service\')
            )
        );
    }

include \'drx_srvcs_team.php\';
include \'drx_srvcs_cafe.php\';
include \'drx_srvcs_announcement.php\';
drx\\U srvcs\\U团队。php

add_action( \'init\', \'drx_service_team_post_type\' );
function drx_service_team_post_type() {
    register_post_type( \'drx_service_team\',
        array (
            \'labels\' => array (
                \'name\'                => _x( \'Service-Team\', \'Post Type General Name\' ),
                \'singular_name\'       => _x( \'Service-Held\', \'Post Type Singular Name\' ),
                \'menu_name\'           => __( \'Service-Team\'),
                \'all_items\'           => __( \'Das Service-Team\'),
                \'view_item\'           => __( \'Service Held anzeigen\'),
                \'add_new_item\'        => __( \'Service-Held hinzufügen\'),
                \'add_new\'             => __( \'Neuer Service-Held\'),
                \'edit_item\'           => __( \'Service-Held bearbeiten\'),
                \'update_item\'         => __( \'Aktualisiere Service-Held\'),
                \'search_items\'        => __( \'Service-Held suchen\'),
            ),
            \'taxonomies\' => array (\'post_tag\', \'category\'),
            \'public\' => true,
            \'menu_icon\' => \'dashicons-groups\',
            \'has_archive\' => true,
            \'supports\' => array ( \'title\', \'editor\', \'thumbnail\', \'excerpt\' ),
            \'rewrite\' => array (\'slug\' => \'service-heroes\')
        )
    );
}
drx\\U srvcs\\U咖啡馆。php:

add_action( \'init\', \'drx_service_cafe_post_type\' );
function drx_service_cafe_post_type() {
    register_post_type( \'drx_service_cafe\',
        array (
            \'labels\' => array (
                \'name\'                => _x( \'Repair Cafés\', \'Post Type General Name\' ),
                \'singular_name\'       => _x( \'Repair Café\', \'Post Type Singular Name\' ),
                \'menu_name\'           => __( \'Cafés\'),
                \'all_items\'           => __( \'Alle Cafés\'),
                \'view_item\'           => __( \'Café anzeigen\'),
                \'add_new_item\'        => __( \'Café hinzufügen\'),
                \'add_new\'             => __( \'Neues Café\'),
                \'edit_item\'           => __( \'Café bearbeiten\'),
                \'update_item\'         => __( \'Aktualisiere Café\'),
                \'search_items\'        => __( \'Café suchen\'),
            ),
            \'taxonomies\' => array (\'post_tag\', \'category\'),
            \'public\' => true,
            \'menu_icon\' => \'dashicons-admin-multisite\',
            \'has_archive\' => true,
            \'supports\' => array ( \'title\', \'editor\', \'thumbnail\', \'excerpt\' ),
            \'rewrite\' => array (\'slug\' => \'service-heroes\')
        )
    );
}
drx\\U srvcs\\U发布。php->这不显示!!

add_action( \'init\', \'drx_srvcs_announcement_post_type\' );
function drx_srvcs_announcement_post_type() {
    register_post_type( \'drx_srvcs_announcement\',
        array (
            \'labels\' => array (
                \'name\'                => _x( \'Termine\', \'Post Type General Name\' ),
                \'singular_name\'       => _x( \'Termin\', \'Post Type Singular Name\' ),
                \'menu_name\'           => __( \'TERMINE\'),
                \'all_items\'           => __( \'Alle Termine\'),
                \'view_item\'           => __( \'Termin anzeigen\'),
                \'add_new_item\'        => __( \'Termin hinzufügen\'),
                \'add_new\'             => __( \'Neuer Termin\'),
                \'edit_item\'           => __( \'Termin bearbeiten\'),
                \'update_item\'         => __( \'Aktualisiere Termin\'),
                \'search_items\'        => __( \'Termin suchen\'),
            ),
            \'taxonomies\' => array (\'post_tag\', \'category\'),
            \'public\' => true,
            \'menu_icon\' => \'dashicons-calendar\',
            \'has_archive\' => true,
            \'supports\' => array ( \'title\', \'editor\', \'thumbnail\', \'excerpt\' ),
            \'rewrite\' => array (\'slug\' => \'termine\')
        )
    );
}
问题是:为什么第四个自定义帖子类型没有出现,我如何解决这个问题?

1 个回复
SO网友:ejoo

我终于找到了。我确信WP\\u在WP config中调试。php被设置为true,但它不是。所以在更改后,我收到一条消息,说一个帖子类型名称最多20个字符。

[2018年4月8日星期日18:29:44.083267][:错误][pid 5901][客户端127.0.0.1:45860]PHP通知:register\\u post\\u type wurdefehlerhaft aufgerufen. 名称为mindestens mus Inhaltstyps einem and maximum 20 Zeichen bestehen。Weitere Informationen:在WordPress(英语)中调试(hinzugef 4.2.0版中的Diese Meldung wurde\\xc3\\xbcgt。)在/var/www/rpc/wp中包含/函数。php第4147行,参考:http://rpc.lkl/wp-admin/plugins.php?plugin_status=all&paged=1&s

我选择了一个较短的名称,现在它出现了!

结束

相关推荐