Support » Plugin: Post Types Order » [Plugin: Post Types Order] Causes never-ending loop of previous_post_link and next_post_link

  • I have a custom post type that is set to show only 1 post per page and I am using previous_post_link and next_post_link at the bottom for navigation, kind of like turning a page.

    When I have this plugin activated it causes a never-ending loop so although I only have 6 posts, it cycles through the first 6 in the right order, and then begins choosing random posts afterward and never ends.

    I need to make this stop so that when it gets to the last post the next_post_link should disappear like it normally does without this plugin.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author nsp-code


    Sorry this might be a little ambiguous due to the code limitations. Only the Advanced Post Types Order contain additional tools to display the next /previous custom post type within the archive or a certain term/taxonomy. For more details you can check this post

    Sorry I’m confused. Are you saying that your plugin breaks native next_post_link / previous_post_link functionality and I have to pay/upgrade in order to get it back?

    I checked out the post you linked to. previous_post_type_link() causes my site to break as does next_post_type_link

    Fatal error: Call to undefined function next_post_type_link()

    Have also tried next_couple_link() (my post type is called “Couple)

    All I am doing is having a page that loops through a custom post type and should link to each post with next_post_link and previous_post_link and when it gets to the last post, the next_post_link should disappear since there are no more posts.

    This is native wordpress functionality and it works perfectly until I enable the post types order plugin.

    Instead, after the last post, it starts grabbing random posts and goes into a never ending loop.

    Plugin Author nsp-code


    No.. i’am not saying that the plugin breaks the native next/previous.
    Just turn the Autosort to OFF and the next/previous will works like before. But you will need to use the menu_order within your queries to receive the posts in the defined order.

    The advanced version include previous_post_type_link/next_post_type_link function which helps for a better navigation through posts using the custom order, no matter the Autosort status.

    Hope it make sense.


    I added orderby=menu_order to my query, and disabled autosort, and this makes it worse. I have ordered the custom posts in a specific order using the plugin, and when I view them after making the above change, a post other than the first one is shown first. And odd enough, the post that is shown is neither first in the menu order, or first in the post type order. It’s from the middle.

    Is menu_order going to work for a post type that is set up like “posts” and not “pages” ?

    Also after making the above change, next_post_link does not return a custom post type anymore. It returns a regular post.

    Plugin Author nsp-code


    Sorry but it appear you didn’t really understand how WordPress Queries works, i suggest checking with to get a better idea about queries, and using the menu_order parameter.

    Either using the next_post_link appear to be clear for you check this link Also you can’t use menu_order along with this without further codding.

    I am aware of how queries work. but we shouldn’t have to write more code to retain the use of next_post_link/previous_post_link. To me this looks like a bug, the fact that a never-ending loop happens. It should stop after the last post.

    The previous/ next links works fine with my theme while te Autosort is off. Serialboxhpc why you may call this a bug when the author said is not implemented? I’am sure there are other nice features to have too along with reordering, i’am not blame anyone i’am aware this is free code.
    Thanks for this great plugin!

    I was not asking for a feature that has not been implemented.

    Without this plugin enabled, I can use previous/next post with my custom post type without any problems. There are 6 posts. I can hit the next post link until the end, and then it stops. THat is how it is supposed to work.

    When I enable this plugin, and turn auto-sort on, I get a never ending loop of posts from my custom post type. It does not stop after 6.

    If I turn auto-sort off, then it displays nothing. It does not grab any posts from my custom post type and returns an empty array.

    As soon as I disable this plugin, it works.

    I am grateful for the free plugin and am not hear to accuse or blame. I was simply asking for help in trying to fix what to me appears to be a bug. If it can’t be fixed or is not seen that way then that’s fine. I can always order my posts by date.

    I had this problem also, but seems if you buy the Advanced version it solves the problems, great plugin !

    Right as Ive been told however I won’t buy a plugin in order to fix a bug that breaks native wordpress functionality.

    I have the same issue I think. When I´m on the latest post I get a ‘previous post’ link which seems to link totally random. There should be no link at all there.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Plugin: Post Types Order] Causes never-ending loop of previous_post_link and next_post_link’ is closed to new replies.