Support » Plugin: SEO Ultimate » Change init.php of Title Tag Rewriter to support filtering new title-tag?

  • Up from WordPress 4.1, the new “title-tag” feature can replace the need for “wp_title” in the theme header.php. So i think this should be implemented in the “filtering” Setting of the Title Tag Rewriter.

    So maybe you could change the titles.php like this:

    function init() {
    		
    		switch ($this->get_setting('rewrite_method', 'ob')) {
    			case 'filter':
                               if(current_theme_supports('title-tag'){
    		add_filter('pre_get_document_title', array(&$this, 'get_title'));
                              } else {
                    add_filter('wp_title', array(&$this, 'get_title'));
    				}
    				break;
    			case 'ob':
    			default:
    				add_action('template_redirect', array(&$this, 'before_header'), 0);
    				add_action('wp_head', array(&$this, 'after_header'), 1000);
    				break;
    		}
    		
    		add_filter('su_postmeta_help', array(&$this, 'postmeta_help'), 10);
    	}

    By this, the filtering method works again for themes using the title-tag feature.

    Also, how about applying an own filter before echoing the title? I use shortcodes in my title tags to insert a soft hyphen where needed, and it would be great if SEO Ultimate would stop putting [shy] in my titles 😉

  • The topic ‘Change init.php of Title Tag Rewriter to support filtering new title-tag?’ is closed to new replies.