Update WordPress to 5.2

This commit is contained in:
Oliver Davies 2019-05-08 08:05:39 +01:00
parent 489b5a5914
commit e00f87f2f5
599 changed files with 119573 additions and 55990 deletions

View file

@ -108,7 +108,9 @@ class Walker_Category extends Walker {
return;
}
$link = '<a href="' . esc_url( get_term_link( $category ) ) . '" ';
$atts = array();
$atts['href'] = get_term_link( $category );
if ( $args['use_desc_for_title'] && ! empty( $category->description ) ) {
/**
* Filters the category description for display.
@ -118,11 +120,40 @@ class Walker_Category extends Walker {
* @param string $description Category description.
* @param object $category Category object.
*/
$link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"';
$atts['title'] = strip_tags( apply_filters( 'category_description', $category->description, $category ) );
}
$link .= '>';
$link .= $cat_name . '</a>';
/**
* Filters the HTML attributes applied to a category list item's anchor element.
*
* @since 5.2.0
*
* @param array $atts {
* The HTML attributes applied to the list item's `<a>` element, empty strings are ignored.
*
* @type string $href The href attribute.
* @type string $title The title attribute.
* }
* @param WP_Term $category Term data object.
* @param int $depth Depth of category, used for padding.
* @param array $args An array of arguments.
* @param int $id ID of the current category.
*/
$atts = apply_filters( 'category_list_link_attributes', $atts, $category, $depth, $args, $id );
$attributes = '';
foreach ( $atts as $attr => $value ) {
if ( ! empty( $value ) ) {
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
$link = sprintf(
'<a%s>%s</a>',
$attributes,
$cat_name
);
if ( ! empty( $args['feed_image'] ) || ! empty( $args['feed'] ) ) {
$link .= ' ';
@ -134,6 +165,7 @@ class Walker_Category extends Walker {
$link .= '<a href="' . esc_url( get_term_feed_link( $category->term_id, $category->taxonomy, $args['feed_type'] ) ) . '"';
if ( empty( $args['feed'] ) ) {
/* translators: %s: category name */
$alt = ' alt="' . sprintf( __( 'Feed for all posts filed under %s' ), $cat_name ) . '"';
} else {
$alt = ' alt="' . $args['feed'] . '"';