Now I know this has been covered quite a lot, but I've read previous fixes on here and haven't had any luck.
Basically my custom post types for questions are giving me 404 errors.
So far I've tried the following:
Code is below:
add_action( 'init', 'irt_questions_create' );
function irt_questions_create() {
$labels = array(
'name' => _x('Questions', 'post type general name', 'your_text_domain'),
'singular_name' => _x('Question', 'post type singular name', 'your_text_domain'),
'add_new' => _x('Add New', 'Question', 'your_text_domain'),
'add_new_item' => __('Add New Question', 'your_text_domain'),
'edit_item' => __('Edit Question', 'your_text_domain'),
'new_item' => __('New Question', 'your_text_domain'),
'all_items' => __('All Questions', 'your_text_domain'),
'view_item' => __('View Question', 'your_text_domain'),
'search_items' => __('Search Questions', 'your_text_domain'),
'not_found' => __('No Questions found', 'your_text_domain'),
'not_found_in_trash' => __('No Questions found in Trash', 'your_text_domain'),
'parent_item_colon' => '',
'menu_name' => __('Questions', 'your_text_domain')
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => _x( 'module', 'URL slug', 'your_text_domain' ) ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => true,
'menu_position' => 106,
'supports' => array( 'title', 'editor', /*'author',*/ 'thumbnail', /*'excerpt', 'comments', 'custom-fields', 'revisions',*/ 'page-attributes')
);
register_post_type('question', $args);
}
After 3 days of trying to fix this I found out it was 'hierarchical' => true giving me the error.
As soon as I removed this line of code and then refreshed the permalinks by Setting the permalinks to default, then changing them back again problem fixed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With