[resolved] Can't understand custom post ype rewrite rule! (4 posts)

  1. au.petrone
    Posted 3 years ago #

    Hi everyone! I'm trying to transorm this




    This is the code I used to register my custom post type:

    function corso_register() {
    	$labels = array(
    		'name' => 'Corsi',
    		'singular_name' => 'Corso',
    		'add_new' => 'Aggiungi un corso',
    		'add_new_item' => 'Aggiungi un corso',
    		'edit_item' => 'Modiica il corso',
    		'new_item' => 'Nuovo corso',
    		'view_item' => 'Visualizza corso',
    		'search_items' => 'Cerca corso',
    		'not_found' =>  'Non ho trovato nulla',
    		'not_found_in_trash' => 'Non ho trovato nulla nel cestino',
    		'parent_item_colon' => ''
    	$args = array(
    		'labels' => $labels,
    		'public' => true,
    		'publicly_queryable' => true,
    		'show_ui' => true,
    		'query_var' => true,
    		'rewrite' => array(
    			'slug' => 'corso',
    		'has_archive' => 'corsi',
    		'capability_type' => 'post',
    		'hierarchical' => false,
    		'menu_position' => null,
    		'supports' => array('title','editor','thumbnail')
    	register_post_type( 'corso' , $args );
    	global $wp_rewrite;

    The 'has_archive' is set to 'corsi' so why it doesn't work??Thank you for the help!

    PS: I searched or old discussion but i couldn't find nothing!

  2. Tara
    Volunteer Moderator
    Posted 3 years ago #

    this codex has lots of info and useful links: http://codex.wordpress.org/Post_Types

  3. Set your slug to "corsi" and then go to Settings > Permalinks and Save Changes.

  4. au.petrone
    Posted 3 years ago #

    Thank you! Solved going in Settings!

Topic Closed

This topic has been closed to new replies.

About this Topic