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: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Taxonomy | Keywords: | has-patch has-unit-tests |
| Focuses: | Cc: |
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.