Skip to content

Instantly share code, notes, and snippets.

@dboutote
Created January 11, 2016 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dboutote/fc2cfafa67cfcc47661b to your computer and use it in GitHub Desktop.
Save dboutote/fc2cfafa67cfcc47661b to your computer and use it in GitHub Desktop.
Instruct WordPress to search on all post types when doing a category taxonomy query.
<?php
function post_type_category_fix($request) {
if ( isset($request['category_name']) && !isset($request['post_type']) )
$request['post_type'] = 'any';
return $request;
};
add_filter('request', 'post_type_category_fix');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment