WordPress.org

Ready to get started?Download WordPress

Forums

parent_id always zero (3 posts)

  1. StevieG
    Member
    Posted 3 years ago #

    I'm trying to use the parent_id to control my sidebars but when I display ther post->parent_id it is always zero. Any ideas?

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    do you mean:

    $post->post_parent

    it might also be disturbed by the loop/query in the main content;

    to reset this, you could try to add: wp_reset_query(); before your conditional statement.

  3. StevieG
    Member
    Posted 3 years ago #

    So simple. Yes that's what was needed. Cheers

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags