Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Can you be more specific as to what, precisely, custom-post-type is? Like actual examples of REAL urls. If it’s what I think, then that feature is as designed. But I want to be sure ??

    Also, having your permalinks be %postname% is a bad idea.

    For details, read https://ottopress.com/2010/category-in-permalinks-considered-harmful/

    hydroplane: try to add empty string for the slug prefix when registering your post type:

    register_post_type('my_custom_post_type', array(
    	//...
    	'rewrite' => array('slug'=>'','with_front'=>false),
    	//...
    ));

    I’m also looking for a solution to this problem… When you add an empty string like the above example I get a 404 page. Even after reseting permalnks.

    I have the same exact problem. Does anyone have a solution? I can rewrite the slug to be a single character, but that’s not going to fly. If my regular posts can follow this permalink structure, why can’t custom post types?

    I can confirm that (in my case) IckataNET has the right answer. Resaving permalinks works.

    .htaccess not rewritable? CMOD 666

    I can confirm that IckataNET’s solution doesn’t work for me. I still get a 404 after saving the permalinks anew.

    I had the same issue and found this post to be very helpful: (https://wpengineer.com/2044/custom-post-type-and-permalink/)

    Re-saving the Permalinks structure in Settings fixed everything.

    I can confirm that this:

    register_post_type('my_custom_post_type', array(
    	//...
    	'rewrite' => array('slug'=>'','with_front'=>false),
    	//...
    ));

    did work for me.

    I can confirm that IckataNET’s solution doesn’t work for me. I still get a 404 after saving the permalinks anew.

    I am pretty sure this has something to do with 3.04 as when i was using 3.0? previously it worked fine.

    The really odd thing is that one of my custom post types is working fine and the other is not.

    This is the register post type for the one that works:

    function my_custom_init()
    {
      $labels = array(
        'name' => _x('Websites', 'post type general name'),
        'singular_name' => _x('Website', 'post type singular name'),
        'add_new' => _x('Add New', 'website'),
        'add_new_item' => __('Add New Website'),
        'edit_item' => __('Edit Website'),
        'new_item' => __('New Website'),
        'view_item' => __('View Website'),
        'search_items' => __('Search Websites'),
        'not_found' =>  __('No Websites found'),
        'not_found_in_trash' => __('No Websites found in Trash'),
        'parent_item_colon' => ''
      );
      $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
        'taxonomies' => array( 'types','features'),
        'menu_position'=>5,
        'supports' => array('title','editor')
      );
      register_post_type('website',$args);
    }

    and this is the one that doesnt work

    function create_qa_post_types() {
    	 $labels = array(
    		'name' => _x( 'FAQ Categories', 'taxonomy general name' ),
    		'singular_name' => _x( 'FAQ Category', 'taxonomy singular name' ),
    		'search_items' =>  __( 'Search FAQ Categories' ),
    		'all_items' => __( 'All FAQ Categories' ),
    		'parent_item' => __( 'Parent FAQ Category' ),
    		'parent_item_colon' => __( 'Parent FAQ Category:' ),
    		'edit_item' => __( 'Edit FAQ Category' ),
    		'update_item' => __( 'Update FAQ Category' ),
    		'add_new_item' => __( 'Add New FAQ Category' ),
    		'new_item_name' => __( 'New FAQ Category Name' ),
      );
      	register_taxonomy('faq_category',array('qa_faqs'), array(
    		'hierarchical' => true,
    		'labels' => $labels,
    		'show_ui' => true,
    		'query_var' => true,
    		'rewrite' => array( 'slug' => 'faq-category' ),
      ));
    	register_post_type( 'qa_faqs',
    		array(
    			'labels' => array(
    				'name' => __( 'FAQs' ),
    				'singular_name' => __( 'FAQ' ),
    				'edit_item'	=>	__( 'Edit FAQ'),
    				'add_new_item'	=>	__( 'Add FAQ')
    			),
    			'public' => true,
    			'show_ui' => true,
    			'capability_type' => 'post',
    	//...
    	'rewrite' => true,
    	//...
    			'taxonomies' => array( 'FAQs '),
    			'supports' => array('title','editor')
    		)
    	);
    }

    Even if i make them identical one will work and the other does not. this is truly odd and frustrating.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Custom post type permalink rewrite’ is closed to new replies.