WordPress.org

Support

Support » How-To and Troubleshooting » Next/Previous ‘TRUE’ parameter not working

Next/Previous ‘TRUE’ parameter not working

  • The post has three categories: 12, 13, and 16. I want to use the next/previous links in each post to link to the next or previous post in category 12. So I wrote the following code:

    <?php previous_post_link('&laquo; %link', 'Previous', TRUE, '13 and 16'); ?>
    <?php next_post_link('%link &raquo;', 'Next', TRUE, '13 and 16'); ?>

    But when I go to the post after saving, I get links to the previous post which has category 13, and the next post which has category 16. (Neither has category 12 just to be clear.)

    I am using Exec-PHP version 4.7 to be able to put php code in my post itself. Could this plug-in somehow be messing with the function, or am I perhaps missing syntax somewhere? Any help would be appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Bump for an answer? Any ideas why this function is not working the way it’s supposed to?

    Try taking it out of the post itself and using it within the loop on single.php. Does this work?

    No it’s not. I put in to skip category 12 and it’s going to those posts anyway.

    <?php previous_post_link('&laquo; %link', 'Previous post in category: %title', TRUE, '12'); ?>
    					<?php next_post_link('%link &raquo;', 'Next post in category: %title', TRUE, '12'); ?>

    Just for the heck of it, have you tried using commas between the excluded categories instead of ‘ and ‘? There was a weird little note about doing this for WordPress 2.2 in the Codex, but I don’t know if it is also for later versions:

    http://codex.wordpress.org/Template_Tags/next_post_link

    Nope, still not working, either in single.php or in post.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Next/Previous ‘TRUE’ parameter not working’ is closed to new replies.