0

If I installed a new WordPress with twentysixteen theme and went to uncategorized page, I will see at the title something like

Category: Uncategorized

how can I remove the category: word from pages titles?

0

For achieve this title you need to extend get_the_archive_title . here is how or check the official doc

function wpse64458_get_the_archive_title($title){
    if ( is_category() ) {
        $title = single_cat_title( '', false );
    } elseif ( is_tag() ) {
        $title = single_tag_title( '', false );
    }
    return $title;
}
add_filter( 'get_the_archive_title', 'wpse64458_get_the_archive_title');
| improve this answer | |
  • it actually works! is there a way to modify it through theme template files not WordPress core files? because if i update my WordPress version everything been modified in WordPress core files will be overwritten by the update – iLinux85 May 21 '19 at 7:29
  • where did you put those code ? you have to put this code I share into your themes file like functions.php then how it will be problem if you are update WordPress core? that filter provided WordPress to us to do this kind of modification. hope it make sense – mlimon May 21 '19 at 7:50
  • i put the code inside wp-includes/general-template.php not in functions.php template file, sorry i am not good with codes and new to these stuff but i will try to add the code to functions.php – iLinux85 May 21 '19 at 7:52
  • please do in your themes file and don't ever edit core file their are not meant for to edit or modified :) – mlimon May 21 '19 at 7:53
  • yes it's now in functions.php theme file instead of wp-includes/general-template.php and it works :) thank you – iLinux85 May 21 '19 at 7:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.