[wp-trac] [WordPress Trac] #21995: (get/the)_archive_title and (get/the)_archive_description functions

WordPress Trac noreply at wordpress.org
Wed Nov 5 19:10:42 UTC 2014


#21995: (get/the)_archive_title and (get/the)_archive_description functions
---------------------------------------------+--------------------------
 Reporter:  thomask                          |       Owner:  johnbillion
     Type:  feature request                  |      Status:  reopened
 Priority:  normal                           |   Milestone:  4.1
Component:  Themes                           |     Version:  trunk
 Severity:  normal                           |  Resolution:
 Keywords:  has-patch twenty-fifteen commit  |     Focuses:  template
---------------------------------------------+--------------------------

Comment (by chrisvanpatten):

 Random (and potentially dumb/ill-informed) idea: what if the prefix were
 set in a separate variable within the function—as @McGuive7 proposed—but
 instead of giving it a dedicated filter it's just passed into
 apply_filters as an additional parameter? That way if you wanted to remove
 the prefix for some reason, you could much more easily do this:

 {{{
 function my_remove_prefix( $title, $prefix ) {
     $just_the_title = str_replace( $prefix, '', $title );
     return $just_the_title;
 }

 add_filter( 'get_the_archive_title', 'my_remove_prefix', 10, 2 );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/21995#comment:48>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list