How to insert the number of posts from the category in wp _title?

If your theme supports WordPress adding the title tag using add_theme_support( ‘title-tag’ ); (it should!) you can use the document_title_parts filter to insert the post count in the right place without needing to parse the full title or modify existing elements that might have been customised, such as the separator: function wpse_323260_document_title_category_count( $title ) { … Read more

Changing title of a page dynamically from within a plugin

A post or page has only one title, the title tag <title> is the document title. The filter wp_title filters the output of wp_title() function, which was used before to output the title of the document. In WordPress 4.1, the title-tag support in themes was introduced and wp_get_document_title() is used instead of wp_title(). So, if … Read more

How to change the seperator in the title

UPDATE for WordPress 4.4 Since WordPress 4.4 the wp_title filter doesn’t work because wp_title() function is not used in core anymore. That function was marked as deprecated, then reinstated until new notice but theme authors are discouraged from using it. Because of that, wp_title filter still will work if you continue using wp_title() function directly … Read more