Skip to content

Android Tutorial Station

Exclude wp_list_categories does not work in WordPress 3.7

The first major bug in WordPress 3.7 has already appeared, is that the parameter exclude from the wp_list_categories function wp_list_categories not work correctly. The developers have already announced that this bug will be fixed with version 3.7.2 of WordPress . Anyway but you can wait because your website depends on this function here we will show how to solve the problem.

Troubleshooting exclude from wp_list_categories in WordPress 3.7

Different solutions can be found over the network, but the most practical is to modify the WordPress engine files to solve the problem. I have chosen this solution because when update 3.7.2 comes, the files that we modify now to solve the problem will be rewritten with the update, so the whole process will be transparent and we will not need to revert any changes we make now .
Another advantage of the solution I am going to propose is that you only need to edit a line in a single file .

The first thing we have to do is edit the file wp-includes/taxonomy.php and look for the line (it is line number 1365):

  $excluded_children = array(); 

And we replace it with:

  $excluded_children = $exclude_tree; 

Remember that the best way to edit PHP files is through an editor that supports UTF-8 (No BOM) encoding, since it is the correct format for PHP files. You can use SublimeText as local editor.

With this we will again have the exclude parameter of the wp_list_categories function working correctly again. It will also allow the plugins that had stopped working for this bug to work correctly again.

I hope you have been helpful and if you have doubts do not hesitate to comment.

No comments yet.

Leave a Reply

Your email address will not be published.

Comments (0)