Skip to content

Instantly share code, notes, and snippets.

@uprise10
Created April 10, 2020 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uprise10/0802a9a3bee9aa19ee3b5266a7a9f4c7 to your computer and use it in GitHub Desktop.
Save uprise10/0802a9a3bee9aa19ee3b5266a7a9f4c7 to your computer and use it in GitHub Desktop.
<?php
$args_cpt = [
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => [
'slug' => 'test-cpt',
'with_front' => true,
],
'has_archive' => 'test-cpt',
'menu_icon' => 'dashicons-location',
'query_var' => true,
'show_in_rest' => true,
'rest_base' => 'test-cpt',
'supports' => [
'title',
'editor',
'excerpt',
'author',
'thumbnail',
'revisions',
'custom-fields',
'page-attributes',
'publicize',
'wpcom-markdown',
],
];
register_post_type( 'test-cpt', $args_cpt );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment