Please note, this is not a theme or so issue.
The categories are not showing in the admin panel, however it denotes that there are 6 categories. They are also visible in the database.
Recently something happened with the hosting and any php move_upload
functions started giving errors about missing tmp path, so I created a local php.ini
file to point to the right tmp
folder (home/user/tmp
) and that solved the issue.
This however seems to be linked. I tried setting these in wp-config
define('WP_TEMP_DIR', '/tmp');
define('DBCR_CACHE_DIR', '/tmp');
but to no avail.
I know this is a very dated post but I am putting this here to be discovered by others as there are many threads across the net without a solution discovered. I had the same issue and did a very deep dive on what is happening. The problem is actually with WordPress core and I have submitted a bug ticket for it here https://core.trac.wordpress.org/ticket/33148. I would recommend adding details to it that I may have missed here.
Defining the problem:
What is happening is WordPress is looking for categories that have no parent id OR are linked to a parent that exists. If the parent id is set to a non-existent id (other than 0 which means no parent) then the categories will not show up in the list. I will attach several screenshots to show what I mean at the database level before and after.
Query run:
As you can see the parent is energy but for some reason the id is not correct. Therefore the children are not linked correctly. I can only assume one of our users removed the parent and then manually added it back but forgot to link the children.
Since I accidentally cutoff the table column names here they are just above.
After you relink the category you should see this in the database
Steps to fix the categorie(s):
I chose option 1 since there may be hooks that are fired on save within plugins or your own custom code. I would think there is less chance of any ill side-effects.
Now the category is there again:
Similar to what @Shawn mentioned in his reply, I had a similar issue but the ID looked correct; no parent issue at all!
What I did was to search for one “invisible category” in the category search field, click on Edit, and then Save (without the need to modify anything).
Then all the sub categories reappeared.