Title: current_page_parent is wrong?!
Last modified: August 19, 2016

---

# current_page_parent is wrong?!

 *  [eswhite](https://wordpress.org/support/users/eswhite/)
 * (@eswhite)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/current_page_parent-is-wrong/)
 * I’m using the a call to `wp_list_pages()` in my sidebar and would like to setup
   some JS/CSS to hide all the sub-pages of other parent-pages. My page structure
   is:
 * # Visitors’ Guide (`page-id-7`)
    * Events Calendar * Island News * Services *
   Island History & Culture * Attractions * Accommodations * Find Local Businesses*
   Directions & Travel Info # Getting Here * Island Map # About * Site Map * For
   Advertisers
 * For some reason, on some pages that are children of Visitors’ Guide, `.current_page_parent`
   is assigned to the wrong li.
 * For example:
    – when Island News or Events Calendar are the current page, Island
   news is assigned `.current_page_parent` – when Directions & Travel Info is the
   current page, Visitors’ Guide is assigned `.current_page_parent` (as it should
   be)
 * The wierdest thing is that Events Calendar & Island News have a div `#content`
   with the class `.parent-pageid-7` (as it should be), so it’s not messed up everywhere.
 * Where do you think this is getting screwed up? (Deleting the Island News page
   and re-creating it did not help.)

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

 *  Thread Starter [eswhite](https://wordpress.org/support/users/eswhite/)
 * (@eswhite)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/current_page_parent-is-wrong/#post-1019522)
 * Is nobody responding because I put this question in the wrong section or because
   you’re not sure what’s going on?
    Thanks!
 *  [cdembinski](https://wordpress.org/support/users/cdembinski/)
 * (@cdembinski)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/current_page_parent-is-wrong/#post-1019523)
 * If I’m getting this correctly, you want to display the sub pages (children) only
   if you are on that parent page.
 * with the wp_list_pages you should be able to exclude the sub pages by setting
   the depth to 1. But to set it up by parent, I think you will need an if statement
   and will have to do it in your sidebar template.
 * maybe someone else will have a better solution.
 *  Thread Starter [eswhite](https://wordpress.org/support/users/eswhite/)
 * (@eswhite)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/current_page_parent-is-wrong/#post-1019529)
 * [@cdembinski](https://wordpress.org/support/users/cdembinski/) thanks for the
   reply.
    To clarify: I’m hiding/showing the sub-pages using JavaScript, and it
   works fine *most* of the time. It isn’t working on particular pages because for
   some reason the `.current_page_parent` class is being applied incorrectly. I’m
   not sure how to troubleshoot this because it seems like a database error.

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

The topic ‘current_page_parent is wrong?!’ is closed to new replies.

## Tags

 * [navigation](https://wordpress.org/support/topic-tag/navigation/)
 * [wp_list_pages](https://wordpress.org/support/topic-tag/wp_list_pages/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [eswhite](https://wordpress.org/support/users/eswhite/)
 * Last activity: [17 years, 3 months ago](https://wordpress.org/support/topic/current_page_parent-is-wrong/#post-1019529)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
