[wp-trac] [WordPress Trac] #13471: Pagination in Blog Post Won't Display Past Page 1
WordPress Trac
wp-trac at lists.automattic.com
Wed Jun 30 18:30:09 UTC 2010
#13471: Pagination in Blog Post Won't Display Past Page 1
--------------------------+-------------------------------------------------
Reporter: krowland08 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: 3.0
Severity: normal | Keywords: pagination, nextpage, permalink
--------------------------+-------------------------------------------------
Comment(by Killing):
Yes been chasing this today :(
The cause is the fix applied in r13781 of wp-includes/canonical.php which
added the following code to fix #11807
{{{
} elseif ( is_single() && strpos($wp_rewrite->permalink_structure,
'%category%') !== false ) {
$category = get_term_by('slug', get_query_var('category_name'),
'category');
$post_terms =
wp_get_object_terms($wp_query->get_queried_object_id(), 'category',
array('fields' => 'tt_ids'));
if ( (!$category || is_wp_error($category)) || (
!is_wp_error($post_terms) && !empty($post_terms) &&
!in_array($category->term_taxonomy_id, $post_terms) ) )
$redirect_url =
get_permalink($wp_query->get_queried_object_id());
}}}
The problem is that get_term_by doesn't support hierarchies so when passed
a second level category e.g. cars/sports it will fail and hence the
rewrite is performed loosing the page information.
The following fixes this but I'm not 100% that the intention is to only
check the last category in the hierarchy, although with our data anything
more would appear to fail. This may indicate that additional fixes are
required but anyway:-
{{{
$category = get_term_by('slug', end( explode( '/',
get_query_var('category_name') ) ), 'category') ;
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/13471#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list