Ticket #3755 (closed defect (bug): fixed)

Opened 5 years ago

Last modified 5 years ago

wp_title function: filter post title before stripping tags

Reported by: jhodgdon Owned by: rob1n
Priority: normal Milestone: 2.2.1
Component: General Version: 2.1
Severity: normal Keywords: filter, wp_title, strip_tags, has-patch
Cc: jhodgdon

Description

At least one plugin (Polyglot) uses special (fake HTML) tags for filtering purposes. In most places in WordPress, filters are called before stripping HTML tags out of titles. However, in the wp_title function, strip_tags is called before apply_filters, so the filtering does not work.

Patch about to be added...

Attachments

general-template.php.diff Download (633 bytes) - added by jhodgdon 5 years ago.
Patch to wp_title function: strip tags after filtering post title
general-template-php4.diff Download (646 bytes) - added by jhodgdon 5 years ago.
Diff for re-patch of the fix that was submitted so it will actually work

Change History

Patch to wp_title function: strip tags after filtering post title

comment:1   ryan5 years ago

1

  • Keywords strip_tags, has-patch added; stip_tags removed

Still unpatched in [5012], same problem still there.

comment:4   ryan5 years ago

  • Status changed from new to closed
  • Resolution set to fixed

(In [5014]) apply filter before stripping tags. Props jhodgdon. fixes #3755

  • Cc jhodgdon added
  • Status changed from closed to reopened
  • Resolution fixed deleted

I just noticed that the way the patch was applied here, the function is still broken. The current file says ([5619] of general-template.php):

229 $title = apply_filters('single_post_title', $title);

230 $title = strip_tags($post->post_title);

As you can see, the second line overrides the first line. It should be (as it was in the original patch):

229 $title = apply_filters('single_post_title', $post->post_title);

230 $title = strip_tags($title);

I am submitting a new patch to fix this patch... will attach shortly...

Jennifer

Diff for re-patch of the fix that was submitted so it will actually work

  • Owner changed from anonymous to rob1n
  • Status changed from reopened to new
  • Milestone changed from 2.2 to 2.2.1
  • Status changed from new to closed
  • Resolution set to fixed

(In [5625]) Fix wp_title single post title filters. Props jhodgdon. fixes #3755

Note: See TracTickets for help on using tickets.