• Theme code:

    City: <?php the_category(' | ') ?>

    Html Code:
    City: <a href="https://sitename.com/category/NY/" title="View all posts in NY" rel="category tag">NY</a>

    i want to remove “View all posts in”
    thank you

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter blueyez

    (@blueyez)

    anyone ?

    ps: i want to keep: … title=”NY” …

    Edit the category-template.php file in wp-includes directory and delete all the “View all posts in” occurences.

    Go to /wp-includes/classes.php, Edit classes.php file and around line 1332.

    Here is the code you want to change.
    $link .= ‘title=”‘ . sprintf(__( ‘View all posts filed under %s’ ), $cat_name) . ‘”‘;

    If you just want the category name to show simply remove everything before the %s.

    This line should now look like
    $link .= ‘title=”‘ . sprintf(__( ‘%s’ ), $cat_name) . ‘”‘;

    The solution above removes it from the category list, usually in sidebars. To remove it in posts, remove it from /wp-includes/content-template.php

    Just to clarify, it’s actually found in /wp-includes/category-template.php

    tommyg73

    (@tommyg73)

    This seems like a good solution,
    however
    when you go to upgrade your WP version, the change gets deleted.
    Can anyone offer a neat theme based solution?

    tommyg73

    (@tommyg73)

    Found a workaround here: https://bavotasan.com/tutorials/remove-the-title-attribute-from-wordpress-category-and-page-lists/
    essentially it’s using a regular expression to remove the title attribute after it’s been created, i.e. in the theme (most likely in either functions.php or header.php)

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘remove “View all posts in” from the_category tag’ is closed to new replies.