WordPress.org

Making WordPress.org


Ignore:
Timestamp:
04/10/2016 10:57:00 PM (3 years ago)
Author:
tellyworth
Message:

Allow Jetpack syncing of the plugin CPT.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r2836 r2924  
    2525        add_action( 'pre_get_posts', array( $this, 'use_plugins_in_query' ) );
    2626        add_filter( 'the_content', array( $this, 'filter_post_content_to_correct_page' ), 1 );
     27        add_filter( 'rest_api_allowed_post_types', array( $this, 'filter_allowed_post_types' ) );
    2728
    2829        add_filter( 'map_meta_cap', array( __NAMESPACE__ . '\Capabilities', 'map_meta_cap' ), 10, 4 );
     
    367368
    368369    /**
     370     * Filter for rest_api_allowed_post_types to enable JP syncing of the CPT
     371     *
     372     * @param array $allowed_post_types
     373     * @return array
     374     */
     375    public function filter_allowed_post_types( $allowed_post_types ) {
     376        $allowed_post_types[] = 'plugin';
     377        return $allowed_post_types;
     378    }
     379
     380    /**
    369381     * Returns an array of pages based on section comments in the content.
    370382     *
Note: See TracChangeset for help on using the changeset viewer.