wordpress register post type rewrite rule doesn’t work
-
First post type :
add_action( 'init', 'create_pressrelease' ); function create_pressrelease() { register_post_type( 'pressreleases', array( 'labels' => array( 'name' => __( 'Press Releases' ), 'singular_name' => __( 'Press Release' ) ), 'has_archive' => true, 'show_in_menu' => 'edit.php?post_type=storefronts', 'public' => true, 'map_meta_cap' => true, 'menu_position' => 4, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'revisions' ), 'taxonomies' => array( 'post_tag' ), 'menu_icon' => 'dashicons-edit', 'has_archive' => 'pressreleases', 'with_front' => false, 'rewrite' => array( 'slug' => 'suppliers/%supplier_name%/pressreleases', ) ) ); }Second post type :
add_action( 'init', 'create_whitepaper' ); function create_whitepaper() { register_post_type( 'whitepapers', array( 'labels' => array( 'name' => __( 'White Papers' ), 'singular_name' => __( 'White Paper' ) ), 'has_archive' => true, 'show_in_menu' => 'edit.php?post_type=storefronts', 'public' => true, 'map_meta_cap' => true, 'menu_position' => 4, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'revisions' ), 'taxonomies' => array( 'post_tag' ), 'menu_icon' => 'dashicons-edit', 'has_archive' => 'whitepapers', 'rewrite' => array( 'slug' => 'suppliers/%supplier_name%/whitepapers', ) ) ); }I have created above post types two , I am able to get first post type correct pages and coming to 2nd post type, I am getting URL but the loads homepage content, why it is happening is there anything that i m missing to include in this both codes.suggest me i am trying since two days I have tired various methods like add_rewrite, perma_structure, need some solution on this
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘wordpress register post type rewrite rule doesn’t work’ is closed to new replies.