is_single returns true in attachement pages (5 posts)

  1. Juan
    Posted 2 years ago #


    Using is_single() in attachment pages returns true but the documentation says that is_single() returns true "for post of any type except attachment and pages", so in attachment is_single() should return false.

    I've solved this using if(is_single() && !is_attachment) but I think this issue is either a bug or a wrong documentation.

  2. Michael
    Forum Moderator
    Posted 2 years ago #

    what theme are you using?

    where in the theme's files are you using the conditional statement?

    does that also happen if tested with the default theme Twenty Thirteen?

  3. Juan
    Posted 2 years ago #


    I'm using header.php file and yes, it happens in default theme Tweny Thirteen.

  4. Juan
    Posted 2 years ago #

    Nobody can confirm this issue?

  5. jonnyauk
    Posted 2 years ago #

    I've just checked and can confirm that you are right - is_single() does seem to return true on attachment pages.

    If this can be confirmed by someone else, a bug report should be created at http://core.trac.wordpress.org/newticket

Topic Closed

This topic has been closed to new replies.

About this Topic