Custom post type: Create permalink from title automatically
-
Hello folks,
I created a custom post type in my own plugin with the following code:
register_post_type('immovation_object', array( 'labels' => array( 'name' => _x('Immobilien2', 'post type general name'), 'singular_name' => _x('Immobilie', 'post type singular name'), ), 'description' => "Immovation by Aweos - Description...", 'public' => true, 'has_archive' => true, 'revisions' => false, 'rewrite' => array( 'slug' => 'iiii', 'with_front' => true), 'menu_position' => 5, 'capability_type' => 'immovation', 'supports' => array( 'custom-fields', 'attachments', 'title', 'thumbnail', 'author' ) ));When I try to create a new post from that post type andgive that new post a title, the permalink of that new post is created automatically as “/iiii//”.
However, I would like to insert the slug from a title automatically, so that the slug would be “/iiii/the-slugged-title”. How can I do that?
The topic ‘Custom post type: Create permalink from title automatically’ is closed to new replies.