Support » Plugins and Hacks » [Resolved] I believe I found a bug.

[Resolved] I believe I found a bug.

  • I’m using this to move through a custom post type series, where they are in the same custom taxonomy. The format for the links is like so:

    previous_post_link_plus(array('format' => '&laquo %link', 'in_same_tax' => 'true',
                                                  'link' => '%title'));
      next_post_link_plus(array('format' => '%link »', 'in_same_tax' => 'true',
                                                  'link' => '%title'));

    My post type is called “courses”.

    When I add the “‘post_type’ => ‘courses'” to the array, the links do not show up (and I get no error messages or warnings). If I remove that, it works fine. I don’t know where the bug is in that, so I just left that part out of the array and it seems to be working fine anyway.


    with the “in same tax” part in there (set to true), the links didn’t show up and I got multiple error messages about the taxonomy array being invalid.

    When I looked in the plugin code, I found this:

    99			if ( $in_same_tax && !$in_same_cat ) {
    100				if ( $in_same_tax === true ) {

    at line 100, you have “===”. If you change that to “==” it resolves the multiple error messages, and the links still work just fine.

    Just thought I’d share.


Viewing 1 replies (of 1 total)
  • Plugin Author ambrosite


    That is not a bug; ‘===’ is the PHP strong equality operator:


    The purpose of that construct in my plugin is to allow to user to pass either the name of a custom taxonomy, or the Boolean value ‘true’, using the same parameter.

    The problem with your sample code is that you are not supposed to surround the value ‘true’ with quotation marks. The word ‘true’ in PHP is a Boolean literal, not a string:


    What happened in your case was that the string ‘true’ failed the strong equality check, and fell through to the section of the code that handles the string as a taxonomy name (which is why you were getting the error about the taxonomy being invalid, since you do not have a custom taxonomy called ‘true’). By making the change you made, you removed the strong equality check, therefore it stayed in the section of the code that auto-detects the taxonomy.

    Tl;dr If you had done it like this, it would have worked:

    previous_post_link_plus(array('format' => '&laquo %link', 'in_same_tax' => true, 'link' => '%title'));
    next_post_link_plus(array('format' => '%link »', 'in_same_tax' => true, 'link' => '%title'));
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] I believe I found a bug.’ is closed to new replies.