How to get rid of tags on a default WordPress theme post / category

On many of my sites I use tags only as a way for related posts to be calculated reasonably correctly. For SEO reasons (duplicate content issues) I would rather they don’t show up on the site itself, and certainly not on every post and category page. The details depend on the aim and structure of the site of course, but on most I want to hide tags as much as possible.

Advanced themes like Thesis have the option of easily getting rid of things like that, but I have recently found myself using the default WordPress themes more – what then? For instance, this is a child theme of the Twenty Fifteen theme.

Well, first off – of course as soon as you’re going to customize a theme, you need to set up a child theme. It turns out there are several plugins available that make this easier. I ended up using Child Theme Configurator. Easy to use – not merely in creating a theme, but also for importing whatever theme files you want to adapt beyond CSS and the functions file. The footer file for instance usually makes my list.

However, in our case we only need the functions file. Find it under Appearance > Editor:

functions-edit

In it the following PHP code gets copied:

function kh_remove_tags() {
add_filter('get_the_tags', '__return_false');
add_filter('the_tags', '__return_false');
} add_action('loop_start', 'kh_remove_tags');

And that’s it!