WordPress.org

Ready to get started?Download WordPress

Forums

is_author function broken (8 posts)

  1. angsuman
    Member
    Posted 8 years ago #

    is_author() function is broken in WP 2.0. It doesn't trigger on author pages.

    Is the issue known / being fixed?
    Any patch available?

  2. Kafkaesqui

    Posted 8 years ago #

    It's working for me. What's the code look like for your "trigger"?

  3. angsuman
    Member
    Posted 8 years ago #

    if(is_author()) {
    // Do blah blah
    }

    I am calling it in a function which is hooked to template_redirect.

    At the same location other functions like is_date() or is_single() etc. are working.

    And I am calling an author page by:
    http://hostname/index.php/author/0/
    or
    http://hostname/index.php?author=0

  4. angsuman
    Member
    Posted 8 years ago #

    In fact is_author() is also not working in a template. As you like code here it goes:

    if(is_author()) {
    echo 'I am in Author Archive';
    }

  5. Kafkaesqui

    Posted 8 years ago #

    Uh, nope. No problem here with is_author() under any of those conditions. Could the issue be related to passing the author value of 0? That should be considered an invalid ID.

  6. angsuman
    Member
    Posted 8 years ago #

    Thanks. That works :)

    BTW: I actually used zero (0). Shouldn't that work too?

  7. Kafkaesqui

    Posted 8 years ago #

    "I actually used zero (0). Shouldn't that work too?"

    Beyond the fact WordPress doesn't provide 0 for an user ID? Well, it runs into the same issue something like ?page_id=0 would, which is in such a query you're actually passing a null value. When that happens WP assumes no query has taken place, and just uses the default query (which would be the home page).

  8. angsuman
    Member
    Posted 8 years ago #

    Thanks for the clarifications.
    Wish you a Happy New Year.

Topic Closed

This topic has been closed to new replies.

About this Topic