Skip to content

Commit

Permalink
SEO: do not display any tags in post titles display in meta tags
Browse files Browse the repository at this point in the history
Fixes 4478-gh-jpop-issues

Some plugins use the the_title filter to add HTML to post titles (to add schema.org metadata for example).
We consequently cannot assume anything returned by get_the_title() will be safe to display in a meta tag.
Let's use the_title_attribute() instead to avoid having any unwanted HTML.
  • Loading branch information
jeherve committed Nov 7, 2019
1 parent bba41df commit 05545a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/seo-tools/jetpack-seo-titles.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public static function get_token_value( $token_name ) {

case 'post_title':
case 'page_title':
return get_the_title();
return the_title_attribute( array( 'echo' => false ) );

case 'group_title':
return single_tag_title( '', false );
Expand Down

0 comments on commit 05545a4

Please sign in to comment.