WordPress.org

Ready to get started?Download WordPress

Forums

custom post type dash in permalink (1 post)

  1. erwanpia
    Member
    Posted 1 year ago #

    Hi, when I use dashes "word-secondword-thirdword" in custom post type permalink, I get 404 (of course after refreshing permalink structure via settings / permalinks in the wp admin)

    when I remove the dashes "wordsecondwordthirdword" , no error, articles get online good. any idea why ?

    second bonus question : how do I put the year in the custom post type structure ?

    register code : `
    function poleouest_article() {
    $labels = array(
    'name' => 'poleouestarticle',
    'singular_name' => 'Article',
    'add_new' => 'Add Article',
    'add_new_item' => 'Add New Article',
    'edit_item' => 'Edit Article',
    'new_item' => 'New Article',
    'all_items' => 'All Articles',
    'view_item' => 'View Article',
    'search_items' => 'Search Articles',
    'not_found' => 'No Articles found',
    'not_found_in_trash' => 'No Articles found in Trash',
    'parent_item_colon' => '',
    'menu_name' => 'Photo News'
    );

    $args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'photobretagnenews' ),

    'has_archive' => true,
    'hierarchical' => false,

    'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
    );

    register_post_type( 'poleouestarticle', $args );
    }
    add_action( 'init', 'poleouest_article' );`

Topic Closed

This topic has been closed to new replies.

About this Topic