WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to register a CPT from a plugin upon activation but seem to have hit a wall... Anyone see anything im missing? I don't get any errors but the CPT doesn't show up in the dashboard links....

    function ctg_cpt_init() {
    register_post_type( 'ctg_questions',
            'labels' => array(
                'name' => __( 'Questions' ),
                'singular_name' => __( 'Question' )
        'public' => true,
        'has_archive' => true,
        'rewrite' => array( 'slug' => 'questions' )
add_action( 'init', 'ctg_cpt_init' );

function ctg_rewrite_flush() {
register_activation_hook( __FILE__, 'ctg_rewrite_flush' );


share|improve this question
I tried your code and the CPT showed up in the Administration Panels primary navigation menu. Do you mean that you're trying to get it to show up in the 'Right Now' meta box on the dashboard? – Ian Dunn Jul 12 '11 at 17:44
Now she's working for me too! I changed the function namespaces before posting here - must've had a keying error. Thanks for everyones help and appologies for the time waster... – Peter Gibbons Jul 12 '11 at 18:03
up vote 1 down vote accepted

Pull the CPT registration functionality out of the Plugin activation hook, so that it can fire at init, where you want it to.

The Plugin activation hook is a one-time only hook; you need your CPT to fire every time at the init hook, not just once.

share|improve this answer
He's calling register_post_type() inside a hook to 'init'. He's only flushing the rewrite rules during the register_activation_hook(). – Ian Dunn Jul 12 '11 at 17:41
Thanks for your answer Chip, appreciated. – Peter Gibbons Jul 12 '11 at 18:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.