Pages practically do NOT have categories. Being assigned to the default category is just an “internal technical” thing for WP. Try to forget about it 🙂
Thread Starter
elyn
(@elyn)
Then how to delete the display of the default category that pages blogged in?
Delete the_category tag from your Page template (page.php)
Thread Starter
elyn
(@elyn)
There is no page.php in my theme template. And to delete this file under the default theme of WP results in nothing. Then I saved index.php of my theme as page.php, delete “<?php _e(“Bloged in”); ?> <?php the_category(‘,’) ?>”. In that case, page won’t display category anymore.
Moshu, thanks. I didn’t catch you until yesterday.
This has been bugging me for a while so I sat down and after about an hour of looking around I found where it’s being called from. My solution assumes a bit of knowledge up front as it involves editing the database, either by hand or through phpmyadmin.
There is a table in the wordpress database that marries the post_id with the category_id, called wp_post2cat. This is where the change needs to be made.
First step is to generate a list of your categories and then match it against your page_id. Replace specific post information from my example with your own.
mysql> select * from wp_categories; (will generate the list)
mysql> select * from wp_post2cat where post_id = “1104”;
+——–+———+————-+
| rel_id | post_id | category_id |
+——–+———+————-+
| 147 | 1104 | 1 |
+——–+———+————-+
1 row in set (0.01 sec)
Now that you’ve made sure it’s there and what the id is:
mysql> UPDATE wp_post2cat
-> SET category_id = ‘5’
-> WHERE post_id = ‘1104’;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
And that’s it. You’ve just changed the category.
Well this is neat, so pages do have categories.
It would be best if the wp team added a selection option inside the main admin menu to allow changing of page categories.
I don’t think categories for pages are bad, I just wish I could change them w/o having to do what htheriault described…
It wouldn’t make any difference. You can change whatever in the database but all the Pages you are going to write after – still would be in the default category. If you change your default category: from that moment on all the new Pages will belong to that new default.
I’ve just cooked it up in several minutes after reading this discussion, available in:
http://me.abelcheung.org/devel/wordpress-page-categories-assignation/
However, it doesn’t mean there is any visible change. Just keep blogger categorize their pages more easily, nothing more. To present pages in a categorized way needs more coding. I believe some plugin has already done that.