[wp-trac] [WordPress Trac] #31237: improve get_the_archive_title() with new filter
WordPress Trac
noreply at wordpress.org
Thu Feb 5 14:43:21 UTC 2015
#31237: improve get_the_archive_title() with new filter
-------------------------+------------------------------
Reporter: ramiy | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: 4.1
Severity: normal | Resolution:
Keywords: | Focuses: template
-------------------------+------------------------------
Comment (by ramiy):
With the current `get_the_archive_title` filter, you have to write a very
long code to filter each and every page type to remove the prefix. It's
not developer friendly.
And as a developer, I prefer to write my own function to replace
`get_the_archive_title()` than using this filter. Writing my own function
is faster and easier than filtering the current function.
On the other hand, a boolean filter is simpler, faster and developer
friendly.
----
For example, using this simple snippet in your `functions.php` file:
{{{
// Remove archive title prefix
add_filter( 'archive_title_prefix', '__return_false' );
}}}
Theme authors can remove the title prefix, and another developer can
create child-theme to add the prefix back (with return true). As i said,
boolean filters are simpler and developers friendly.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31237#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list