Custom post type&Custom permalinks problem
-
1. Install WordPress
2. Install plugin Custom Permalinks
3. Select Post name on Permalink Settings page
4. Add custom type to functions.php
add_action( ‘init’, ‘create_post_type’ );
function create_post_type() {
register_post_type( ‘custom-post-type’,
array(
‘labels’ => array(
‘name’ => __( ‘Cusom Post Type’ ),
‘singular_name’ => __( ‘Cusom Post Type’ )
),
‘public’ => true,
‘has_archive’ => true,
‘rewrite’ => array(‘slug’ => ‘custom-post-type’),
‘supports’ => array( ‘title’, ‘editor’, ‘thumbnail’ )
)
);
}
5. Create record in this type “Home of custom post type” and set “custom-post-type/” URL for it (ie, URL is equal to “Rewrite” slug in this custom type)
6. Create record in this type “Sub page of custom type”, use default URL for it
7. View this record – it will not show correctly (Error 404)
The topic ‘Custom post type&Custom permalinks problem’ is closed to new replies.