xwp / stream

🗄️ Stream plugin for WordPress

Home Page:https://wordpress.org/plugins/stream/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Labels not seen for CPT registered on init with default priority

fjarrett opened this issue · comments

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.