Changeset 13223
- Timestamp:
- 02/20/2024 01:16:24 AM (11 months ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r13221 r13223 1382 1382 1383 1383 wp_safe_redirect( $url, 301 ); 1384 die();1385 }1386 1387 // Existing tag with no plugins.1388 if (1389 is_tax( 'plugin_tags' ) &&1390 ! have_posts() &&1391 // Only redirect if only plugin_tags is queried. Other taxonomies cannot be handled.1392 count( $wp_query->tax_query->queried_terms ) <= 11393 ) {1394 // [1] => plugins [2] => tags [3] => example-plugin-name [4..] => random().1395 $path = explode( '/', $_SERVER['REQUEST_URI'] );1396 1397 wp_safe_redirect( home_url( '/search/' . urlencode( $path[3] ) . '/' ), 301 );1398 1384 die(); 1399 1385 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-meta-sync.php
r13220 r13223 28 28 $this->sync_ratings(); 29 29 $this->update_tested_up_to(); 30 $this->cleanup_empty_terms(); 30 31 31 32 Manager::clear_memory_heavy_variables(); … … 196 197 } 197 198 } 199 200 /** 201 * Remove old plugin tags that are no longer in use. 202 */ 203 public function cleanup_empty_terms() { 204 $taxonomies = [ 205 'plugin_tags', 206 'plugin_contributors', 207 'plugin_committers', 208 'plugin_support_reps' 209 ]; 210 foreach ( $taxonomies as $taxonomy ) { 211 $terms = get_terms( array( 212 'taxonomy' => $taxonomy, 213 'hide_empty' => false, 214 'count' => true, 215 ) ); 216 217 $terms = array_filter( $terms, function( $term ) { 218 return $term->count === 0; 219 } ); 220 221 foreach ( $terms as $term ) { 222 wp_delete_term( $term->term_id, $term->taxonomy ); 223 } 224 } 225 } 198 226 }
Note: See TracChangeset
for help on using the changeset viewer.