If you’re running a WordPress site and have recently upgraded to version 3.1, you may have come across a strange problem since the update: your category pages keep redirecting to the home page.
The standard approach to addressing WordPress problems like this is to turn off all your plugins and turn them back on one at a time. This is a tried and true method of resolving issues, but it’s time consuming too. Is there a shortcut? Well there is if you know which plugins are not compatible with the latest version of WordPress.
We have discovered a number of WordPress installs that have had this problem, and all were resolved by deactivating the plugin called Simple Tags. If you have this plugin installed and have experienced the category redirect problem, we suggest you deactivate this one first, before having to go through the full suite of your plugins and turning them on again one by one.
If you create a post, save it in a subcategory (instead of a top level category), and you later want to change the location of that post to another subcategory, you may find that the other subcategories that you could move it to have vanished, and only the top level categories are visible.
For example, let’s say you were writing an article on personal loan debt consolidation (where you join multiple loans together into one combined loan – to make it easier to pay and often at a lower overall interest rate). You write the article and when you create it in WordPress admin, set the category to “Debt Consolidation” which you have set up as a subcategory of “Personal Loans”.

If you later decide to go back and edit that article to include information about car finance, when you get to the edit post screen in admin, the “car finance” subcategory is gone. Where did it go?
This is caused by the default behaviour of WordPress which puts the chosen category at the top of the categories box in Edit Post. The code that checks for the checked category and pushes it up to the top of the list then loses the connection between the subcategory and the parent.
As at the time of writing (WordPress 3.0.5), the only easy way to resolve this issue is to edit some core WordPress code. It’s not a hard edit – it involves “turning off” the feature that pushes the checked categories to the top of the list.
Here’s how:
Open the file wp-admin/includes/template.php
Find the line function wp_terms_checklist in the code. The code around it will look a bit like this:
/**
* Taxonomy independent version of wp_category_checklist
*
* @param int $post_id
* @param array $args
*/
function wp_terms_checklist($post_id = 0, $args = array()) {
Scroll down in this function and find a piece of code towards the end of this function that looks like this:
foreach( $keys as $k ) {
if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
$checked_categories[] = $categories[$k];
unset( $categories[$k] );
}
}
Comment this out by putting /* in front of this block of code, and */ at the end of it. So it will look like this:
/* foreach( $keys as $k ) {
if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
$checked_categories[] = $categories[$k];
unset( $categories[$k] );
}
} */
And you’re done. The Edit Post categories box now looks the same as the Create Posts categories box, and you can add “Car Finance” as a category for your post.
Want to create your own WordPress sidebar that is accessible in admin under Widgets? It’s easier to do than you may think. Here’s how.
There are three basic steps to the process:
- Tell WordPress about your sidebar and give it a name
- Add it to your template so that WordPress can find the sidebars in the place you want them to appear
- Go into Widgets in your WordPress admin and add widgets to your sidebar
Tell WordPress about your new sidebar and give it a name
You will need to edit the functions.php file for your theme. There are a few functions.php files in a WordPress installation, so make sure that you get the one in the root folder of your theme. For example if your theme is called geekz, it would be in /wp-content/themes/geekz/functions.php
Open the file and take a look at it – try to find some other blocks of code that look like this:
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Navigation',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
));
The Navigation part will have the wording of whatever sidebar is part of your theme, and often the before_widget, after_widget, before_title and after_title will have html in them as well. These set the styling tags for the sidebar container and the defaults for the content within the sidebar container. If these are set you can style them in your stylesheet.
Under this block add a similar block of code for your custom sidebar widget. We’ll create one called top_sidebar with an h2 style on the headings of any widgets in the sidebar.
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>',
));
The div class=”widget” part tells WordPress to wrap the whole widget in a container called “widget” which you can then apply a styling to. If you haven’t used that class name anywhere else in your site, it could be used to give the widgets in that sidebar a different styling from your main sidebar.
If the text just prints out or you get a blank page, check the location of your code very carefully and see if you need to add <?php and ?> tags around the block of code.
Now place the sidebar in your template
The most common place you’ll want to place a sidebar is somewhere in the sidebar.php file of your theme. But you may want to put it somewhere else – wherever you decide to do, here’s the code that you need:
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('top_sidebar') ) : ?>
<?php endif; ?>
Substitute out top_sidebar for the name of the sidebar that you created in the steps above; And that’s it – you can now go into your WordPress admin under Appearance > Widgets and your new sidebar will be there – ready to drag any WordPress widget in to. And because you didn’t edit any core files, it will still be there when you upgrade your version of WordPress.
If a standard user creates an account in your WordPress site, after the registration process is complete or after they return and log back in to your site, by default they will see what is called the Profile page. By default, this page looks a lot like your WordPress admin backend, with none of your site branding on it. What can you do about this?
You could hack the code to force the login process to redirect back to the page of your choice, and there is plenty of help on how to do this on the WordPress forums. But the problem with this approach is as soon as you need to upgrade your WordPress version or make a duplicate of your website on another domain, you’ll need to do it manually. Otherwise, your code hacks will be lost. That means a lot of hard work, comparing files and updating code – every time the core of WordPress changes. If you want to promote your website or are building your blog website to help promote your main shop or information site, then that’s too much hassle that you don’t need.
Fortunately, there is a free WordPress plugin available that makes light work of this task. It is called Theme My Profile. What this plugin allows you to do is to either provide a different look for your profile page if you wish to display it, or block it altogether and redirect people to a different page of your choice (for example, a custom my account page). You can create different pages or block the profile page by user type. (We don’t recommend using it for admin users as you could end up blocking yourself out of admin by mistake).
You can see this plugin in action at our Australian Clothing and Fashion Directory website (and at the same time, submit your website for a free link if it’s fashion related). And if you’re a Geekz business web hosting customer in the fashion industry, please contact us for a little discount offer on your first year’s membership
If you’ve logged into your WordPress site today, you may have seen that it’s telling you that WordPress 3.0.5 has been released and to Please update now. We strongly recommend that everyone with a WordPress site does this upgrade, as it contains some important security fixes; especially for those of you who give access to your blog to authors.
The latest version improves the level of protection of security issues fixed in the previous version of WordPress, as well as closing a hole which potentially allowed article authors and editors to gain higher level priviledges than they had access to, as well as to see posts and pages they did not have access to (e.g. drafts and private posts). See the full list of fixes on the WordPress Blog.
How to upgrade WordPress
While you can upgrade your WordPress manually, the easiest way to upgrade is just to click on the “Please update now” link that appears in your WordPress admin. A manual install would be required if you have manually edited the core of WordPress, however. Most people wouldn’t do this as WordPress plugins don’t generally require edits to core files.