-
-
Save brentini/0a692a9e32aac2368eb15d3ebb7e7f62 to your computer and use it in GitHub Desktop.
WordPress - Custom post with custom permalink (slug) #wordpress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action( 'init', 'register_new_post_type' ); | |
| function register_new_post_type(){ | |
| $args = array( | |
| 'label' => 'Post title', | |
| 'show_ui' => true, | |
| 'public' => true, | |
| 'hierarchical' => true, | |
| 'has_archive' => true, | |
| 'supports' => array( 'title' ), | |
| 'rewrite' => array( | |
| 'slug' => 'new_post_type', | |
| 'with_front' => false | |
| ) | |
| ); | |
| register_post_type( 'new_post_type', $args ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment