Support » Fixing WordPress » Category is missing when writing post

  • At least one of my categories isn’t showing up in the right menu where you select the post’s category. Any ideas why this is happening? There aren’t any strange characters in the name, and there was one post already in that category so it’s not empty.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Is the post in that entry ‘published’. If you have created, saved but not ‘published’ the post then the category you refer to will not show up.

    Yes, the post is published 🙁 and I even published a 2nd post with the same category (had to update the catid in phpMyAdmin) and still nothing.

    I found another category that’s missing from the “Write” page. The only thing the two have in common (that I can see) is that neither one had had a new post in around 2 months, could that be it?

    Also worth mentioning is that the category still doesn’t appear if I’m trying to edit the post. There are no categories selected.

    That happened to me once when I post-dated a post. In other words, I created a post and added the appropriate categories (making sure they were checked to be used) and then used the Edit Time-Stamp function to make sure that the post wouldn’t appear until I wanted it to. When it did finally appear right on time, it had only the categories that were in place prior to that posting. None of the added categories were associated with it or would even show up when I went to edit it. I had to re-add them to the post in the edit window. This resulted in all of those categories being correctly associated with that post, but there were, strangely, just a couple of them that ended up in the category list twice, once associated with the post and once empty. I then had to go back through the Manage Categories list to delete the duplicate, empty categories.

    Anyway, I know this is kind of long, but I thought it might either help your situation or someone else looking through the forums for a similar problem.

    ptvguy, I’m not sure I follow your explanation, might be because it’s late and I’m about to crash into my bed 😛 sounds to me like you’re attributing the problem to updating the timestamp to a later date? If so that’s not the case with mine as I know at least a few of these have never had their timestamp touched.

    The two categories I knew were missing have returned after I switched to another server (for unrelated reasons) but now there are 10 others missing, some of which are some of the newest categories I’ve created.

    Also noting that when I moved to a new server, I did a completely fresh install of WP, although I did import the old data from the previous host.

    Again, every single category has at least one post as I don’t create categories until I need them. I’ll check in tomorrow.

    ptvguy, I tried what I think you suggested (re-creating the category in the edit window) but it didn’t work, there was no duplicate and the category still doesn’t show up in the list.

    Sorry, egarcia, but I spoke/wrote too soon. I associated the disappearing category situation with the appearance of a post-dated (?pre-dated?) post, because that was the first time I noticed it. As it turns out (and I would have known this sooner if the forum search hadn’t been down when I was hunting for it) the problem–at least in my case–had to do with a preset WP limit of 100 categories. You can create more, but they won’t show up in your Write or Edit Post sidebar. The fix is posted elsewhere ( but with some pertinent details left out.

    The following function:

    function return_categories_list($parent = 0) {
    global $wpdb;
    return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY category_count DESC LIMIT 100");

    is located in the “wp-admin” folder in a file called “admin-functions.php”. You have to edit that externally from WP and change the default limit to a larger number like 10000 so that it looks like this:

    function return_categories_list($parent = 0) {
    global $wpdb;
    return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY category_count DESC LIMIT 10000");

    I did have a sneaking suspicion about 100 because I noticed categories with a higher catID were missing (but 2 of them DID show which is why I didn’t pursue this).

    Ironically, I tried “adding” a new category with the same name (similar to what you had suggested earlier) but with a fresh new post and that did bring up a missing category. But I’ll give the function hack a go before “recreating” the categories 🙂 Thanks ptvguy.

    Worked like a charm, thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Category is missing when writing post’ is closed to new replies.