Title: parent_id always zero
Last modified: August 19, 2016

---

# parent_id always zero

 *  [stevieg](https://wordpress.org/support/users/stevieg/)
 * (@stevieg)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/parent_id-always-zero/)
 * 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?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/parent_id-always-zero/#post-1856784)
 * 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.
 *  Thread Starter [stevieg](https://wordpress.org/support/users/stevieg/)
 * (@stevieg)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/parent_id-always-zero/#post-1856816)
 * So simple. Yes that’s what was needed. Cheers

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘parent_id always zero’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [stevieg](https://wordpress.org/support/users/stevieg/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/parent_id-always-zero/#post-1856816)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
