diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php
index b9eb6dd689f..ab6f86660fb 100644
a
|
b
|
function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' |
1271 | 1271 | * @type string $separator Separator for between the terms. Default '/'. |
1272 | 1272 | * @type bool $link Whether to format as a link. Default true. |
1273 | 1273 | * @type bool $inclusive Include the term to get the parents for. Default true. |
| 1274 | * @type bool $reverse Wether to reverse the hierarchical order of the Terms on output. Default true. |
1274 | 1275 | * } |
1275 | 1276 | * @return string|WP_Error A list of term parents on success, WP_Error or empty string on failure. |
1276 | 1277 | */ |
… |
… |
function get_term_parents_list( $term_id, $taxonomy, $args = array() ) { |
1293 | 1294 | 'separator' => '/', |
1294 | 1295 | 'link' => true, |
1295 | 1296 | 'inclusive' => true, |
| 1297 | 'reverse' => true, |
1296 | 1298 | ); |
1297 | 1299 | |
1298 | 1300 | $args = wp_parse_args( $args, $defaults ); |
1299 | 1301 | |
1300 | | foreach ( array( 'link', 'inclusive' ) as $bool ) { |
| 1302 | foreach ( array( 'link', 'inclusive', 'reverse' ) as $bool ) { |
1301 | 1303 | $args[ $bool ] = wp_validate_boolean( $args[ $bool ] ); |
1302 | 1304 | } |
1303 | 1305 | |
… |
… |
function get_term_parents_list( $term_id, $taxonomy, $args = array() ) { |
1306 | 1308 | if ( $args['inclusive'] ) { |
1307 | 1309 | array_unshift( $parents, $term_id ); |
1308 | 1310 | } |
| 1311 | |
| 1312 | if( $args['reverse'] ){ |
| 1313 | $parents = array_reverse( $parents ); |
| 1314 | } |
1309 | 1315 | |
1310 | | foreach ( array_reverse( $parents ) as $term_id ) { |
| 1316 | foreach ( $parents as $term_id ) { |
1311 | 1317 | $parent = get_term( $term_id, $taxonomy ); |
1312 | 1318 | $name = ( 'slug' === $args['format'] ) ? $parent->slug : $parent->name; |
1313 | 1319 | |