Custom Post Type redirects to site root

Home Support Forums Multiple Themes Custom Post Type redirects to site root

This topic contains 1 reply, has 1 voice, and was last updated by  netkitchen 5 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10753

    netkitchen
    Participant

    Your plugin works great when I point it to any page or the default directory for posts http://getfeedback.nkv3.com/blog/ (pass: dev). But when applied to a Custom Post Type http://getfeedback.nkv3.com/news/ , any method I try redirects anything in that directory back to the site root.

    I tried using default WordPress templates with the same result. This is the code being used to create the custom post type. Any help would be so greatly appreciated.

    /** custom post type news */
    add_action( ‘init’, ‘melissa_custom_post_type’ );
    function melissa_custom_post_type() {

    register_post_type( ‘news’,
    array(
    ‘labels’ => array(
    ‘name’ => __( ‘News’, ‘wpsites’ ),
    ‘singular_name’ => __( ‘News’, ‘wpsites’ ),
    ),
    ‘has_archive’ => true,
    ‘hierarchical’ => true,
    ‘menu_icon’ => ‘dashicons-media-text’,
    ‘public’ => true,
    ‘rewrite’ => array( ‘slug’ => ‘news’, ‘with_front’ => false ),
    ‘supports’ => array( ‘title’, ‘editor’, ‘author’, ‘thumbnail’, ‘excerpt’, ‘trackbacks’, ‘custom-fields’, ‘revisions’, ‘page-attributes’,’comments’ ),
    ‘taxonomies’ => array( ‘news’, ‘post_tag’ ),
    ));

    }

    #10761

    netkitchen
    Participant

    This was an issue with our code to add the Custom Post Type. Here is updated code in case it helps anyone else:
    /** custom post type news */
    add_action( ‘init’, ‘melissa_custom_post_type’ );
    function melissa_custom_post_type() {
    register_post_type( ‘news’,
    array(
    ‘labels’ => array(
    ‘name’ => __( ‘News’, ‘wpsites’ ),
    ‘singular_name’ => __( ‘News’, ‘wpsites’ ),
    ),
    ‘has_archive’ => true,
    ‘hierarchical’ => true,
    ‘menu_icon’ => ‘dashicons-media-text’,
    ‘public’ => true,
    ‘publicly_queryable’ => true,
    ‘query_var’ => true,
    ‘capability_type’ => ‘post’,
    ‘has_archive’ => true,
    ‘rewrite’ => array( ‘slug’ => ‘news’, ‘with_front’ => false ),
    ‘supports’ => array( ‘title’, ‘editor’, ‘author’, ‘thumbnail’, ‘excerpt’, ‘trackbacks’, ‘custom-fields’, ‘revisions’, ‘page-attributes’,’comments’ ),
    ‘taxonomies’ => array( ‘news’, ‘post_tag’ ),
    ));

    }

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.