• Resolved Andy Mercer

    (@kelderic)


    I have built a more flexible function which I called site_title, to replace wp_title. It provides a differing title based on post type and a few other things. However, it’s causing an error and from your comments on other threads, it’s not allowed.

    I’d like to ask why it is required to use the default function, and if the rule is set in stone for themes in the Repository, or if it can be bent? Thanks.

    https://ww.wp.xz.cn/plugins/theme-check/

Viewing 1 replies (of 1 total)
  • Plugin Author Samuel Wood (Otto)

    (@otto42)

    ww.wp.xz.cn Admin

    You should use add_theme_support( 'title-tag' ); to let WordPress add the title, and then use the wp_title filter to modify the title as you like instead.

    Using a custom function means that other plugins and code which also want to modify the title can’t do it, because they don’t know about your custom function. The filter lets everything have a go at changing the contents of the title.

Viewing 1 replies (of 1 total)

The topic ‘Why is wp_title() Required vs Custom Built Function’ is closed to new replies.