diff options
Diffstat (limited to 'plugins/jetpack/modules/custom-post-types/portfolios.php')
-rw-r--r-- | plugins/jetpack/modules/custom-post-types/portfolios.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/jetpack/modules/custom-post-types/portfolios.php b/plugins/jetpack/modules/custom-post-types/portfolios.php index 920fcbd2..8e0078bd 100644 --- a/plugins/jetpack/modules/custom-post-types/portfolios.php +++ b/plugins/jetpack/modules/custom-post-types/portfolios.php @@ -35,7 +35,10 @@ class Jetpack_Portfolio { // Make sure the post types are loaded for imports add_action( 'import_start', array( $this, 'register_post_types' ) ); - $setting = get_option( self::OPTION_NAME, '0' ); + // Add to REST API post type whitelist + add_filter( 'rest_api_allowed_post_types', array( $this, 'allow_portfolio_rest_api_type' ) ); + + $setting = Jetpack_Options::get_option_and_ensure_autoload( self::OPTION_NAME, '0' ); // Bail early if Portfolio option is not set and the theme doesn't declare support if ( empty( $setting ) && ! $this->site_supports_custom_post_type() ) { @@ -471,6 +474,15 @@ class Jetpack_Portfolio { } /** + * Add to REST API post type whitelist + */ + function allow_portfolio_rest_api_type( $post_types ) { + $post_types[] = self::CUSTOM_POST_TYPE; + + return $post_types; + } + + /** * Our [portfolio] shortcode. * Prints Portfolio data styled to look good on *any* theme. * |