[wp-trac] [WordPress Trac] #49805: missing get_the_title / confusing the_title filter

WordPress Trac noreply at wordpress.org
Sat Apr 4 08:52:05 UTC 2020


#49805: missing get_the_title / confusing the_title filter
--------------------------+-----------------------------
 Reporter:  thomask       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I and probably many others (e.g. #39848) got problems with filtering H1 -
 the problem is, that in most templates (and also in twenty twenty) there
 is no way how to filter H1.

 There is the_title function, that encloses the get_the_content() result
 with defined prefix and suffix, but this the_title function has no filter!

 And what is VERY confusing - there is the_title filter, but that filter is
 not called from the_title function, but from get_the_title function!

 I understand that it would be probably very difficult to move that
 the_title function where it belongs and replace it with proper
 get_the_title filter, but i believe there must be some quick way, e.g.
 that proposed wrap (but i would recommend to add all the arguments of the
 the_title function, so resulting in apply_filters( 'the_title_wrap',
 $title, $before, $after, $echo  ); This way we could easily filter the
 result based on any option.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49805>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list