Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm customizing a theme for a client from a theme they bought off of themeforest.net. I created a child theme, where all the customization is located.

Here is the issue: There are several custom post types in the parent theme that work perfectly if you use the parent them. But as soon as the child them is activated, I get 404 errors.

Some Notes:

  • I've flushed rewrite rules and changed and saved the permalink, but no help.
  • The parent theme's CPT shows in the admin backend, just not on the frontend.
  • I added a cpt to the child theme and it works perfectly.

ADDED: In the parent theme, the cpts are registered in a custom class with the class instantiated in the functions.php without a hook.

Here are the cpt parameters that are passed to the class when instantiated:

/* The Custom Post Types */
'post-types' => array(

'gallery' => array(
    'plural' => 'galleries', //plural : optional, but usefull in this case

),



'release' => array(

    'menu_name' => 'Discography',
),

'review' => array(
    'supports' => array('title','editor','thumbnail', 'comments'),
    'exclude_from_search' => false
    ),

'show' => array(),

'item' => array(

    'menu_name' => 'Store',
),

'video' => array(

    'hide_text_editor' => true,
    'seo' => false

),

Here is the snippet in the CPT class for registering the cpt:

    $args = array(
    'labels'                => $labels,
    'public'                => true,
    'publicly_queryable'    => true,
    'show_ui'               => true,
    'show_in_menu'          => true,
    'query_var'             => false,
    'rewrite'               => array( 'slug' => $slug ),
    'capability_type'       => 'post',
    'has_archive'           => false,
    'hierarchical'          => false,
    'menu_position'         => 5,
    'taxonomies'            => array(),
    'supports'              => $supports,
    'exclude_from_search'   => $exclude_from_search,

);
register_post_type($id, $args);

Any ideas?

share|improve this question
UPDATE: Fixed the issue in case anyone needs this for a parent theme. The theme's author failed to put flush_rewrite_rules(); after register_post_type(). In the child theme, I added an action hooked to after_theme_setup to flush the rewrite rules. – user28254 Mar 2 at 0:10
Make that an answer – Camil Staps Mar 2 at 6:21
you can also just visit the permalinks setting page and it will flush the rules. This is the easiest way to do it. – BandonRandon Mar 3 at 18:43

closed as too localized by toscho Apr 14 at 8:45

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.