Menu

How to use Custom Post Types in the WordPress Jetpack REST API

The example adds support for the Custom Post Type named ‘portfolio’. You would add this function to the functions.php in your theme or a plugin:

<?php
add_filter( 'rest_api_allowed_post_types', 'allow_my_post_types');
function allow_my_post_types($allowed_post_types) {
$allowed_post_types[] = 'portfolio';
return $allowed_post_types;
}
?>
view raw functions.php hosted with ❤ by GitHub