Opened 9 years ago
Last modified 9 years ago
#39754 new defect (bug)
`_post_format_get_terms()` can overwrite names of terms in other taxonomies
| Reported by: | dlh | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Taxonomy | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description
_post_format_get_terms() filters 'get_terms' and includes this logic:
if ( in_array( 'post_format', (array) $taxonomies ) ) {
if ( isset( $args['fields'] ) && 'names' == $args['fields'] ) {
foreach ( $terms as $order => $name ) {
$terms[$order] = get_post_format_string( str_replace( 'post-format-', '', $name ) );
}
}
...
which affects the names of all $terms, as long as post_format was one of the queried taxonomies. Many terms are replaced with an empty string from get_post_format_string().
The attached patch includes a test to demonstrate the issue, and it would check before changing a value that the value begins with post-format- and that get_post_format_string() returns a name for the value.
Attachments (1)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)