Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[WordPress] WordPress Post Types: An Abstraction For Entities
<?php
add_action( 'init', 'acme_create_book_post_type' );
/**
* Creates a new custom post type called 'Book' using the smallest number of arguments
* to prepare the post type.
*/
function acme_create_book_post_type() {
$args = array(
'labels' => array(
'name' => 'Books',
'singular_name' => 'Book',
),
'public' => true,
);
register_post_type( 'acme_book', $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.