• MikeB12

    (@mikeb12)


    I’ve tried reading up on past posts here but my head is just spinning.

    My problem is I’d like to change my permalink structure for a custom full width posts under a custom category.

    For example, my permalink structure for posts is example.com/04/2013/postname and for my custom posts I’d like the permalink structure to be example.com/categoryname/postname.

    What’s the easiest way to accomplish this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • J M

    (@hiphopinenglish)

    You need to use the rewrite function when registering a CPT. See the example below from the Codex:

    add_action( 'init', 'create_post_type' );
    function create_post_type() {
    	register_post_type( 'acme_product',
    		array(
    			'labels' => array(
    				'name' => __( 'Products' ),
    				'singular_name' => __( 'Product' )
    			),
    			'public' => true,
    			'has_archive' => true,
    			'rewrite' => array('slug' => 'products'),
    		)
    	);
    }

    ^^Your slug will not be products!

    Thread Starter MikeB12

    (@mikeb12)

    Thanks! I should add the custom post is already created. But I want to go back into the custom post code and edit the permalink structure and make it different from the permalinks from the rest of my standard posts.

    J M

    (@hiphopinenglish)

    Then my suggestion should work. Make the change, create a Post if you haven’t already, view it, and see what URL is returned.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Changing permalink of custom posts’ is closed to new replies.