Making WordPress.org


Ignore:
Timestamp:
05/31/2016 07:30:22 PM (9 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Fix to honor code reference post type search filters.

Props keesiemeijer.
Fixes #1733.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/search.php

    r3241 r3276  
    5858                // Restrict search to function-like content.
    5959                $query->set( 'post_type', array( 'wp-parser-function', 'wp-parser-method' ) );
    60             } else {
    61                 // Search parsed post types instead of all post types.
    62                 $query->set( 'post_type', DevHub\get_parsed_post_types() );
    6360            }
    6461        }
     62
     63        // Get post types (if used, or set above)
     64        $qv_post_types = array_filter( (array) $query->get( 'post_type' ) );
     65        $qv_post_types = array_map( 'sanitize_key', $qv_post_types );
     66
     67        if ( ! $qv_post_types ) {
     68            // Not a handbook page, or exact search, or filters used.
     69            // Fallback to parsed post types.
     70            $query->set( 'post_type', DevHub\get_parsed_post_types() );
     71        }
    6572    }
    6673
Note: See TracChangeset for help on using the changeset viewer.