Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * This plugin will fix a 404 error when viewing a paginated category listing of
- * a custom post type when the custom permalink string is /%category%/%postname%/
- * The problem is the request only checks for items with the 'post' type
- * To fix the problem, add custom post types to the request
- */
- function fix_category_pagination($qs){
- if(isset($qs['category_name']) && isset($qs['paged'])){
- $qs['post_type'] = get_post_types($args = array(
- 'public' => true,
- '_builtin' => false
- ));
- array_push($qs['post_type'],'post');
- }
- return $qs;
- }
- add_filter('request', 'fix_category_pagination');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement