WordPress.org

Making WordPress.org

Changeset 7600


Ignore:
Timestamp:
08/09/2018 08:58:06 PM (14 months ago)
Author:
obenland
Message:

Plugins/Themes: Add CPT to Jetpack sitemaps

See #3540.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins
Files:
2 edited

Legend:

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

    r7048 r7600  
    4040        add_filter( 'rest_api_allowed_post_types', array( $this, 'filter_allowed_post_types' ) );
    4141        add_filter( 'pre_update_option_jetpack_options', array( $this, 'filter_jetpack_options' ) );
     42        add_filter( 'jetpack_sitemap_post_types', array( $this, 'jetpack_sitemap_post_types' ) );
    4243        add_action( 'template_redirect', array( $this, 'prevent_canonical_for_plugins' ), 9 );
    4344        add_action( 'template_redirect', array( $this, 'custom_redirects' ), 1 );
     
    12331234        echo $icon->toSVG();
    12341235        die();
     1236    }
     1237
     1238    /**
     1239     * The array of post types to be included in the sitemap.
     1240     *
     1241     * @param array $post_types List of included post types.
     1242     * @return array
     1243     */
     1244    public function jetpack_sitemap_post_types( $post_types ) {
     1245        $post_types[] = 'plugin';
     1246
     1247        return $post_types;
    12351248    }
    12361249
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php

    r6554 r7600  
    207207
    208208/**
     209 * The array of post types to be included in the sitemap.
     210 *
     211 * @param array $post_types List of included post types.
     212 * @return array
     213 */
     214function wporg_themes_sitemap_post_types( $post_types ) {
     215    $post_types[] = 'repopackage';
     216
     217    return $post_types;
     218}
     219add_filter( 'jetpack_sitemap_post_types', 'wporg_themes_sitemap_post_types' );
     220
     221/**
    209222 * Returns the specified meta value for a version of a theme.
    210223 *
Note: See TracChangeset for help on using the changeset viewer.