Opened 6 years ago
Last modified 7 months ago
#45955 new enhancement
Twenty Nineteen: get_the_archive_title filter issues
Reported by: | taskotr | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Bundled Theme | Keywords: | has-patch needs-testing |
Focuses: | Cc: |
Description
I was testing the theme with a plugin that adds a custom post type and allows to set a custom title for the custom post type archive view using the following filter:
add_filter( 'get_the_archive_title', 'slug_set_the_archive_title' );
While this filter works fine in the previous WordPress themes, such as Twenty Seventeen, Twenty Sixteen and Twenty Fifteen, it does not work in Twenty Nineteen.
It's possible to fix it by setting a priority parameter in the filter. For example:
add_filter( 'get_the_archive_title', 'slug_set_the_archive_title', 99 );
The problem is that it breaks a header style, meaning the title will have the style of the archive view prefix text (grey color and serif font style).
Any idea what is the better way to use this filter in the
Twenty Nineteen theme?
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Hi @taskotr, Welcome to WordPres Trac! Thanks for the report.
Theme already used
add_filter( 'get_the_archive_title', 'twentynineteen_get_the_archive_title' );
archive filter with priority of 10 so if you want to override that filter with your plugin functionality then you have to add high priority then 10 then your filter works in Twenty Nineteen.For ex.
If you have develop plugin with below filter then add below priority.
If you have use any third party plugin and it's filter does not work then remove theme filter using below code.
For better solution, In Twenty Nineteen theme we needs to change filter priority to 1 instead of 10 so plugin can override filter as per there needs.