How to Fix the Exclude Tree Pages Bug in WordPress 2.7

Sometimes a new WordPress release messes up things that they fixed in a previous version. Here we go again with the irritating exclude pages bug in WordPress! The fix is something similar to post I blogged about in August

My fix was inspired by this post from Texto.de. I also posted my exclude_tree fix on the WordPress forum.

Open up wp-includes/post-template.php in your favourite editor. Look for the line 616:

$r['hierarchical'] = 0;

Add 2 back slashes to the code to “comment hide” it.

//$r['hierarchical'] = 0;

That’s all there is to it! Stop using the exclude_tree parameter for the wp_list_pages function until a fix has been announced.

About the Author

Vince is a web designer & developer with a passion for creating web sites with clean and functional designs and source code that is valid, efficient, readable, secure and search engine friendly.

Vince is also a vegan and big animal lover. He is currently working towards his dream of living off-the-grid in Australia so that he can live freely in a self-sufficient and eco-friendly manner.

Similar Posts

6 Comments On “How to Fix the Exclude Tree Pages Bug in WordPress 2.7”

j

On 9th March 2009 3:19 PM, j said:

This is a disable more than a fix, correct?

Vincent

On 9th March 2009 3:34 PM, Vincent said:

It is a fix. The default 2.7 code does not allow exclude pages.

Willans

On 28th April 2009 1:28 PM, Willans said:

Must agree with J. If it was a fix, it would make it work. All you’ve done is disable something.

Vincent

On 28th April 2009 2:10 PM, Vincent said:

Do you have a better solution? I have no idea why WordPress messes up this exclude page feature.

j

On 28th April 2009 3:28 PM, j said:

I went a different route with this and used a plugin called BigBigMenu (http://www.bigbigtech.com/wordpress-plugins/big-big-menu/) that a friend of mine wrote. It did the trick with only a small adjustment to include children categories + pages.

Geejay

On 1st June 2009 5:10 AM, Geejay said:

Why doesn’t it work with mine? It excludes only up to 3 pages. I need to exclude up to 8 pages.

1 Trackback On “How to Fix the Exclude Tree Pages Bug in WordPress 2.7”

Post a Comment