Changeset 9870
- Timestamp:
- 05/13/2020 06:00:48 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php
r9864 r9870 1099 1099 } 1100 1100 1101 $post = get_ post();1102 if ( ! $post ) {1101 $post = get_queried_object(); 1102 if ( ! $post || !( $post instanceof WP_Post ) ) { 1103 1103 return; 1104 1104 } … … 1121 1121 echo "<meta name='twitter:image' content='" . esc_attr( $theme->screenshot_url . '?w=560&strip=all' ) . "' />\n"; 1122 1122 } 1123 1124 // If it's outdated, noindex the theme.1125 if ( time() - strtotime( $theme->last_updated ) > 2 * YEAR_IN_SECONDS ) {1126 add_filter( 'wporg_noindex_request', '__return_true' );1127 }1128 1123 } 1129 1124 add_action( 'wp_head', 'wporg_themes_add_meta_tags' ); 1125 1126 /** 1127 * Noindex outdated themes. 1128 */ 1129 function wporg_themes_noindex_request( $noindex ) { 1130 if ( is_single() && ( $post = get_queried_object() ) && $post instanceof WP_Post ) { 1131 $theme = wporg_themes_theme_information( $post->post_name ); 1132 if ( $theme ) { 1133 // If it's outdated, noindex the theme. 1134 if ( time() - strtotime( $theme->last_updated ) > 2 * YEAR_IN_SECONDS ) { 1135 $noindex = true; 1136 } 1137 } 1138 } 1139 1140 return $noindex; 1141 } 1142 add_filter( 'wporg_noindex_request', 'wporg_themes_noindex_request' ); 1130 1143 1131 1144 /**
Note: See TracChangeset
for help on using the changeset viewer.