Created
August 29, 2016 06:10
-
-
Save websupporter/e15c829d8444dccc069e33f97c36eccf to your computer and use it in GitHub Desktop.
How to register a custom post type for the REST API #wcfra
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 | |
function register_cpt() { | |
$args = array( | |
'labels' => array( | |
'name' => 'Name', | |
'singular_name' => 'Single', | |
), | |
'menu_position' => 5, | |
'public' => true, | |
'show_in_rest' => true, // Mache diesen Post Type über die API zugänglich. | |
); | |
register_post_type( 'cpt', $args ); | |
} | |
add_action( 'init', 'register_cpt' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment