Making WordPress.org

Changeset 2925


Ignore:
Timestamp:
04/11/2016 06:15:06 AM (9 years ago)
Author:
tellyworth
Message:

Filter Jetpack options to ensure public is always true. Needed so that CPTs are seen as public.

File:
1 edited

Legend:

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

    r2924 r2925  
    2626        add_filter( 'the_content', array( $this, 'filter_post_content_to_correct_page' ), 1 );
    2727        add_filter( 'rest_api_allowed_post_types', array( $this, 'filter_allowed_post_types' ) );
     28        add_filter( 'pre_update_option_jetpack_options', array( $this, 'filter_jetpack_options' ), 10, 2 );
    2829
    2930        add_filter( 'map_meta_cap', array( __NAMESPACE__ . '\Capabilities', 'map_meta_cap' ), 10, 4 );
     
    379380
    380381    /**
     382     * Filter for pre_update_option_jetpack_options to ensure CPT posts are seen as public and searchable by TP
     383     *
     384     * @param mixed $new_value
     385     * @param mixed $old_value
     386     * @return mixed
     387     */
     388    public function filter_jetpack_options( $new_value, $old_value ) {
     389        if ( is_array($new_value) && array_key_exists( 'public', $new_value ) )
     390            $new_value['public'] = 1;
     391
     392        return $new_value;
     393    }
     394
     395    /**
    381396     * Returns an array of pages based on section comments in the content.
    382397     *
Note: See TracChangeset for help on using the changeset viewer.