diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2016-08-23 20:02:23 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2016-08-23 20:02:50 -0400 |
commit | ad3f35663e4e2b80a92166b590d3e2052b5aab91 (patch) | |
tree | 94f987efbdb50e1426956c1c04ac459a19c77e53 /plugins/jetpack/modules/custom-post-types/portfolios.php | |
parent | bin/update-wordpress: also update twentyfourteen twentyfifteen twentysixteen (diff) | |
download | blogs-gentoo-ad3f35663e4e2b80a92166b590d3e2052b5aab91.tar.gz blogs-gentoo-ad3f35663e4e2b80a92166b590d3e2052b5aab91.tar.bz2 blogs-gentoo-ad3f35663e4e2b80a92166b590d3e2052b5aab91.zip |
Update plugin jetpack to 4.2.2
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. * |