Making WordPress.org


Ignore:
Timestamp:
06/11/2021 05:56:31 AM (4 years ago)
Author:
dd32
Message:

Search: Allow searching regular bbPress forums, not just plugin/theme variants.

See #5771.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-performance-optimizations.php

    r11025 r11027  
    9494
    9595        $tab = $_GET['tab'] ?? 'support';
    96         if ( ! in_array( $tab, [ 'support', 'docs', 'plugin', 'theme' ] ) ) {
     96        if ( ! in_array( $tab, [ 'support', 'docs', 'plugin', 'theme', 'searchforum' ] ) ) {
    9797            $tab = 'support';
    9898        }
     
    101101            case 'theme':
    102102            case 'plugin':
     103            case 'searchforum':
    103104                wp_safe_redirect( add_query_arg( $tab, $_GET[ $tab ], home_url( "/search/{$search_terms}/" ) ) );
    104105                exit;
     
    151152                ]
    152153            ] );
     154
     155            add_filter( 'posts_where', array( $this, 'posts_in_last_year' ) );
     156        } elseif ( ! empty( $_GET['searchforum'] ) ) {
     157            $query->set( 'post_parent', (int) $_GET['searchforum'] );
    153158
    154159            add_filter( 'posts_where', array( $this, 'posts_in_last_year' ) );
Note: See TracChangeset for help on using the changeset viewer.