Support » Fixing WordPress » Updated to 3.4.1 and custom post type pagination seems amiss…

  • Resolved wcjcs


    I noticed the in-post paging for a custom post type wasn’t working…. the tags were displayed on the screen, so I edited the post and found that the open/close tags had been converted to entities. I changed them back to the proper brackets and saved. The result is that the first nextpage tag is being rendered onscreen, but the following nextpage tags are being obeyed and counted. Was there an update in 3.4.1 that may have something to do with this?

    Thanks for any insight.


Viewing 15 replies - 1 through 15 (of 27 total)
  • esmi


    Forum Moderator

    Not that I’m aware of – otherwise we’d have had a mini-flood of reports by now. My guess is that this is theme or plugin related.

    I should have added: this is only happening with custom post types, not the native post/page types.

    Thanks. I suspect you’re right about that, though it’s only been out for a very short time. Since I’ve been using the same theme and plugins all along, and the error only occurred after updating to 3.4.1 minutes ago, I suspect it’s in there somewhere.

    It’s definitely a weird behavior… when I now re-edit the post, it’s showing all the nextpage tags as intended (in the source editor), but when it’s rendered as a post, the first tag is rendered onscreen while the subsequent nextpage tags (in the same post) work. Because the others are working and it’s just the first tag affected, I copy and pasted one of the ones from below in the post, to ensure it wasn’t a typo I was glazing over. 😉



    Forum Moderator

    3.4.1 was primarily a security upgrade with a few minor bug fixes. Nothing major that should have broken a theme. what I have sometimes come across, though, is a theme or a plugin that has been taking advantage of a core bug which then falls over when that bug is fixed. Right now, that’s the only thing I can think of that might have caused the problem. Where was the theme from?

    I’m going to chalk this up to wonky-internet lol. I’ve done absolutely nothing except read the 3.4 info page and the error seems to be gone now after refreshing the page a few times. Well, that’s good…though I do hate it when that happens. 🙂 Thanks for your time.



    Forum Moderator

    Might be worth checking your server’s error logs if you have access to them. Perhaps something else was running on the server at that time that caused an issue – such as consuming a lot of server resources.

    I don’t dare get too distracted by it at the moment, but I’ll be curious to take a look.

    Custom post type pagination appears to be broken in WP 3.4. There are posts about it all over the web.

    Thanks for the heads up, aljuk. I’ve found a handful of posts on this as well and, to follow up with esmi, my server logs showed nothing out of the ordinary. So yea, this thread isn’t actually resolved after all.

    My guess regarding the non-existent flood of posts here is that nobody is going to notice the problem until/unless they go back and look at a paginated post of a custom post type (and carefully) — if they even updated to 3.4.1. I don’t use any pagination on the front page, so I haven’t seen the problem there myself.

    For some reason, the first <–nextpage–> tag found in a post is being converted into entities. Resaving the post seems to work, but that’s only a viable solution for sites with very few posts. Wish I had more time to sort it out, but my schedule calls the shots, so I’m just going to revert versions; 3.4 didn’t seem to have any issues with CPT paging.

    On further reflection, ‘broken’ is inaccurate. It’s just that the query is being handled in a slightly different (better) way, hence the improvements to the permalink structure of the cms as a whole, which has tripped up a few of us.

    Is there a fix for this yet? I’m seeing the very same issue

    Here is how i fixed this:

    Add this code to functions.php file of your theme:

    if ( ! function_exists( 'ucc_add_cpts_to_pre_get_posts' ) ) { function ucc_add_cpts_to_pre_get_posts( $query ) { if ( $query->is_main_query() && ! is_post_type_archive() && ! is_archive() && ! is_search() && ! is_singular() && ! is_404() ) { $my_post_type = get_query_var( 'post_type' ); if ( empty( $my_post_type ) ) { $query->set('post_type', 'video'); } } } } add_action( 'pre_get_posts', 'ucc_add_cpts_to_pre_get_posts' );

    And use this to query your posts:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $loop = new WP_Query(array('post_type' => 'name_of_post_type','paged'=>$paged));

    Appreciate your posting this; I reverted everything back to 3.4 because it seems that many questions on the forum go unanswered, unresolved. Rooting out this fix was still about 2 weeks down my to-do list… well, it was. Thanks for helping me scratch it off the roster!

Viewing 15 replies - 1 through 15 (of 27 total)
  • The topic ‘Updated to 3.4.1 and custom post type pagination seems amiss…’ is closed to new replies.