Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Labels not seen for CPT registered on init with default priority #565

Closed
frankiejarrett opened this issue Jun 10, 2014 · 0 comments · Fixed by #586
Closed

Labels not seen for CPT registered on init with default priority #565

frankiejarrett opened this issue Jun 10, 2014 · 0 comments · Fixed by #586
Labels

Comments

@frankiejarrett
Copy link
Contributor

Today I discovered yet another issue caused by #532.

If a custom post type is registered on the init hook (like in the example below) the labels will not display in Stream or in the Context dropdown filter.

function register_book_cpt() {
    $args = array(
        'public' => true,
        'labels' => array(
            'name'          => 'Books',
            'singular_name' => 'Book',
        ),
    );

    register_post_type( 'book', $args );
}
add_action( 'init', 'register_book_cpt' );

Registering on init with a priority of 8, or an earlier hook like after_setup_theme, remedies the problem.

However, since the Codex example recommends using init with the default priority of 10, I think we need to discover a work-around on our end.

@frankiejarrett frankiejarrett changed the title Labels not seen for CPT registered on init Labels not seen for CPT registered on init with default priority Jun 10, 2014
@frankiejarrett frankiejarrett self-assigned this Jun 11, 2014
@frankiejarrett frankiejarrett removed their assignment Aug 24, 2015
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
1 participant