Opened 5 years ago
Last modified 5 years ago
#48122 new feature request
Add separator argument for wp_get_document_title()
Reported by: | ngdangtu | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | dev-feedback has-patch |
Focuses: | ui, template | Cc: |
Description
As far as I know, there is an official way to customize WordPress title-tag support. And my suggestion that we should allow devs change separator of title-tag. So, I decided to modify lines: (the lines' position is a bit relative)
1027 : Add a new argument ($separator) with '-' as default value which allow to change $sep variable.
1116 : Replace value '-' with $separator.
1151 : Add a new argument ($sep) with '-' as default value. This will allow devs add their own separator through hook.
1156 : Pass $sep to wp_get_document_title() function.
Attachments (2)
Change History (6)
#1
@
5 years ago
- Component changed from Customize to Themes
- Keywords needs-patch added; needs-testing removed
Hi @ngdangtu, welcome to WordPress Trac! Thanks for the report.
Could you create a patch with your suggested improvements?
Check out https://make.wordpress.org/core/handbook/tutorials/trac/submitting-a-patch/ and https://make.wordpress.org/core/handbook/tutorials/working-with-patches/ to learn more about creating patches.
#2
@
5 years ago
Add a ticket patch.
This patch reduces modification from 4 lines to 2 lines (remove changing line 1151 and 1156) since _wp_render_title_tag() is a private function.
I suggest the new argument because it might be useful for meta title or to display in other position of web which might need a few modification while calling wp_get_document_title(). I hope this suggestion is useful to other devs.
The modified general-template.php which