Making WordPress.org


Ignore:
Timestamp:
07/19/2017 10:47:02 PM (7 years ago)
Author:
coreymckrill
Message:

WordCamp JP Tweaks: Add wc post types to whitelist for Jetpack REST API

This allows WordCamp post types (speaker, session, sponsor) to be
compatible with various Jetpack integrations, such as WordPress.com For
Google Docs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/jetpack-tweaks/miscellaneous.php

    r5560 r5706  
    2525
    2626add_action( 'plugins_loaded', __NAMESPACE__ . '\modify_hooks_after_jetpack_init' );
     27
     28/**
     29 * Filter the post types Jetpack has access to, and can synchronize with WordPress.com.
     30 *
     31 * @see Jetpack's WPCOM_JSON_API_ENDPOINT::_get_whitelisted_post_types();
     32 *
     33 * @param array $allowed_types Array of whitelisted post types.
     34 *
     35 * @return array Modified array of whitelisted post types.
     36 */
     37function add_post_types_to_rest_api( $allowed_types ) {
     38    $allowed_types += array( 'wcb_speaker', 'wcb_session', 'wcb_sponsor' );
     39
     40    return $allowed_types;
     41}
     42
     43add_filter( 'rest_api_allowed_post_types', __NAMESPACE__ . '\add_post_types_to_rest_api' );
Note: See TracChangeset for help on using the changeset viewer.