Making WordPress.org

Changeset 9819


Ignore:
Timestamp:
05/04/2020 02:27:48 AM (4 years ago)
Author:
dd32
Message:

Theme Directory: Skip outdated themes in the Jetpack Sitemaps.

Fixes #5022.

File:
1 edited

Legend:

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

    r9638 r9819  
    234234}
    235235add_filter( 'jetpack_active_modules', 'wporg_themes_disable_sitemap_for_rosetta' );
     236
     237/**
     238 * Skip outdated themes in Jetpack Sitemaps.
     239 *
     240 * @param bool $skip If this post should be excluded from Sitemaps.
     241 * @param object $plugin_db_row A row from the wp_posts table.
     242 * @return bool
     243 */
     244function wporg_themes_jetpack_sitemap_skip_post( $skip, $theme_db_row ) {
     245    // If it's outdated, don't include in Jetpack Sitemap.
     246    if ( time() - strtotime( $theme_db_row->post_modified_gmt ) > 2 * YEAR_IN_SECONDS ) {
     247        $skip = true;
     248    }
     249
     250    return $skip;
     251}
     252add_filter( 'jetpack_sitemap_skip_post', 'wporg_themes_jetpack_sitemap_skip_post', 10, 2 );
    236253
    237254/**
Note: See TracChangeset for help on using the changeset viewer.