I'm looking for a way to remove the title attribute from links. There is a old plugin but it breaks the site.

The title I would like to remove is in the sidebar widget. Thats the code of the widget part:

    // Coupon Catetories Widget
class CLPR_Widget_Coupon_Categories extends WP_Widget {

    function __construct() {
        $widget_ops = array( 'description' => __( 'Display the coupon categories.', APP_TD ), 'classname' => 'widget-coupon-cats' );
        parent::__construct( 'coupon-cats', __( 'Clipper Coupon Categories', APP_TD ), $widget_ops );

    function widget($args, $instance) {
        global $wpdb;
        extract( $args );
        $title = apply_filters('widget_title', empty($instance['title']) ? __( 'Coupon Categories', APP_TD ) : $instance['title']);

        if (strpos($before_widget, 'customclass') !== false)
            $before_widget = str_replace('customclass', 'cut', $before_widget);
            $before_widget = str_replace('customclass', '', $before_widget);

        echo $before_widget;

        if ( $title ) echo $before_title . $title . $after_title;

            $tax_name = APP_TAX_CAT;
            echo '<div class="coupon-cats-widget"><ul class="list">';


            echo '</ul></div>'; 

        echo $after_widget;

    function update($new_instance, $old_instance) {
        return $new_instance;

    function form($instance) {
        $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
        $title = esc_attr($instance['title']);
            <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', APP_TD ); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>

closed as off-topic by Tom J Nowell Nov 28 '18 at 1:38

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • Can you ellaborate a little as to why you are trying to do this? What problem does it solve? – Tom J Nowell Nov 27 '18 at 21:35
  • I can not change certain description from taxonomy categories and the title=shows irritating content. Therefore I need to remove it. Also for SEO Reason. – joloshop Nov 27 '18 at 21:39
  • Whoever told you it affected SEO was talking BS. Would it not have been better to ask how to change those descriptions? Pretty much everything can be changed, even if it isn't clear how. Additionally, by understanding where the title attributes and links are, you might get a better answer. Right now the assumption is that you want them removed from links inside post content, or, the super old links table functionality – Tom J Nowell Nov 27 '18 at 21:42
  • They are located in a custom category list in one of the sidebar widgets. – joloshop Nov 27 '18 at 21:50
  • How is the custom category list widget implemented? – Tom J Nowell Nov 28 '18 at 1:38

You could provide some more details, like what title attributes you are trying to remove. In the navigation, content, etc. Anyway, you could try adding this to your theme or child theme's functions.php file, I have yet to test it though.

function remove_title_attributes($input) {
    return preg_replace('/\s*title\s*=\s*(["\']).*?\1/', '', $input);
add_filter('wp_list_pages', 'remove_title_attributes');
  • Thank you for the tipp. Unfortunately it's not working. Still showing title on custom categories list in widgets. – joloshop Nov 27 '18 at 21:31
  • "custom categories list in widgets" OK, that makes sense, what theme are you using? – RiddleMeThis Nov 27 '18 at 21:56

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