Skip to:
Content

bbPress.org

Changeset 5162


Ignore:
Timestamp:
11/23/2013 09:23:49 AM (8 years ago)
Author:
johnjamesjacoby
Message:

Allow 'bbp_has_search_results' filter to still run even if no search terms were passed. This brings it inline with other component queries. Fixes #2356.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/search/template.php

    r5134 r5162  
    8686    $r = bbp_parse_args( $args, $default, 'has_search_results' );
    8787
    88     // Don't bother if we don't have search terms
    89     if ( empty( $r['s'] ) )
    90         return false;
    91 
    9288    // Get bbPress
    9389    $bbp = bbpress();
    9490
    9591    // Call the query
    96     $bbp->search_query = new WP_Query( $r );
     92    if ( ! empty( $r['s'] ) ) {
     93        $bbp->search_query = new WP_Query( $r );
     94    }
    9795
    9896    // Add pagination values to query object
     
    103101    $bbp->search_query->is_home        = false;
    104102
    105     // Found posts
    106     if ( !$bbp->search_query->found_posts )
    107         return false;
    108 
    109103    // Only add pagination is query returned results
    110     if ( (int) $bbp->search_query->found_posts && (int) $bbp->search_query->posts_per_page ) {
     104    if ( ! empty( $bbp->search_query->found_posts ) && ! empty( $bbp->search_query->posts_per_page ) ) {
    111105
    112106        // Array of arguments to add after pagination links
Note: See TracChangeset for help on using the changeset viewer.