How to disable category description on hovers and have smaller pages in WordPress

WordPress categories on hover

The WordPress category widget, by default, creates an on hover category description when you move the mouse over a category. You can see an example in the image above.

To do this, WordPress adds the description of each category on each page where the widget is. So, you end up having the category descriptions in every page of your site.

This can be a problem if you have rich category descriptions, i.e. long descriptions, like 1kb each. It may then happen that you put an extra size of 20kb or so in each of your pages.

This behaviour can be disabled with the following code. Add it to the functions.php file in your (child) theme