Ticket #7534: 7534-add-browse-preview.diff
File 7534-add-browse-preview.diff, 1.7 KB (added by , 7 months ago) |
---|
-
class-plugin-directory.php
546 546 ) ); 547 547 548 548 // Add the browse/* views. 549 add_rewrite_tag( '%browse%', '(featured|popular|beta|blocks|block|new|favorites|adopt-me|updated )' );549 add_rewrite_tag( '%browse%', '(featured|popular|beta|blocks|block|new|favorites|adopt-me|updated|preview)' ); 550 550 add_permastruct( 'browse', 'browse/%browse%' ); 551 551 552 552 // Create an archive for a users favorites too. … … 795 795 // For any invalid values passed to browse, set it to featured instead 796 796 if ( 797 797 ! empty ( $wp_query->query['browse'] ) && 798 ! in_array( $wp_query->query['browse'], array( 'featured', 'popular', 'beta', 'blocks', 'block', 'new', 'favorites', 'adopt-me', 'updated' ) )798 ! in_array( $wp_query->query['browse'], array( 'featured', 'popular', 'beta', 'blocks', 'block', 'new', 'favorites', 'adopt-me', 'updated', 'preview' ) ) 799 799 ) { 800 800 $wp_query->query['browse'] = 'featured'; 801 801 $wp_query->query_vars['browse'] = 'featured'; … … 817 817 818 818 break; 819 819 820 case 'preview': 821 $wp_query->query_vars['orderby'] ??= 'last_updated'; 822 823 // Limit the Beta tab to plugins updated within 12 months. 824 $meta_query = $wp_query->get( 'meta_query' ) ?: []; 825 $meta_query['live-preview'] = [ 826 'key' => '_public_preview', 827 'value' => '1', 828 'compare' => '=', 829 ]; 830 $wp_query->set( 'meta_query', $meta_query ); 831 832 break; 833 820 834 case 'favorites': 821 835 $favorites_user = wp_get_current_user(); 822 836 if ( ! empty( $wp_query->query_vars['favorites_user'] ) ) {