Created
June 20, 2012 17:05
-
-
Save mattboon/2960966 to your computer and use it in GitHub Desktop.
WordPress - Verbose rules to fix /page/2 issues with Custom Post Types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// http://wordpress.stackexchange.com/a/16929/9244 | |
add_action( 'init', 'wpse16902_init' ); | |
function wpse16902_init() { | |
$GLOBALS['wp_rewrite']->use_verbose_page_rules = true; | |
} | |
add_filter( 'page_rewrite_rules', 'wpse16902_collect_page_rewrite_rules' ); | |
function wpse16902_collect_page_rewrite_rules( $page_rewrite_rules ) | |
{ | |
$GLOBALS['wpse16902_page_rewrite_rules'] = $page_rewrite_rules; | |
return array(); | |
} | |
add_filter( 'rewrite_rules_array', 'wspe16902_prepend_page_rewrite_rules' ); | |
function wspe16902_prepend_page_rewrite_rules( $rewrite_rules ) | |
{ | |
return $GLOBALS['wpse16902_page_rewrite_rules'] + $rewrite_rules; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment