Support » Plugins » Hacks » Can't understand custom post ype rewrite rule!

  • Resolved au.petrone

    (@aupetrone)


    Hi everyone! I’m trying to transorm this

    http://localhost/wp_pluginDev/?post_type=corso

    in

    http://localhost/wp_pluginDev/corsi/.

    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;
     	$wp_rewrite->flush_rules();
    }

    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!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can't understand custom post ype rewrite rule!’ is closed to new replies.