Skip to content

Instantly share code, notes, and snippets.

@brentini
Forked from marcosnakamine/functions.php
Last active March 23, 2018 21:43
Show Gist options
  • Select an option

  • Save brentini/0a692a9e32aac2368eb15d3ebb7e7f62 to your computer and use it in GitHub Desktop.

Select an option

Save brentini/0a692a9e32aac2368eb15d3ebb7e7f62 to your computer and use it in GitHub Desktop.
WordPress - Custom post with custom permalink (slug) #wordpress
<?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