Make WordPress Core


Ignore:
Timestamp:
09/30/2025 05:04:35 PM (2 months ago)
Author:
desrosj
Message:

Grouped backports for the 5.4 branch.

  • REST API: Increase the specificity of capability checks for collections when the edit context is in use.
  • Menus: Prevent HTML in menu item titles from being rendered unexpectedly.

Merges [60814], [60815], [60816] to the 5.4 branch.

Props andraganescu, desrosj, ehti, hurayraiit, iandunn, joehoyle, johnbillion, jorbin, mnelson4, noisysocks, peterwilsoncc, phillsav, rmccue, timothyblynjacobs, vortfu, westonruter , whyisjake, zieladam.

Location:
branches/5.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.4

  • branches/5.4/src/wp-includes/class-wp-customize-nav-menus.php

    r47383 r60832  
    159159            } elseif ( 'post' !== $object && 0 === $page && $post_type->has_archive ) {
    160160                // Add a post type archive link.
     161                $title   = $post_type->labels->archives;
    161162                $items[] = array(
    162                     'id'         => $object . '-archive',
    163                     'title'      => $post_type->labels->archives,
    164                     'type'       => 'post_type_archive',
    165                     'type_label' => __( 'Post Type Archive' ),
    166                     'object'     => $object,
    167                     'url'        => get_post_type_archive_link( $object ),
     163                    'id'             => $object_name . '-archive',
     164                    'title'          => $title,
     165                    'original_title' => $title,
     166                    'type'           => 'post_type_archive',
     167                    'type_label'     => __( 'Post Type Archive' ),
     168                    'object'         => $object_name,
     169                    'url'            => get_post_type_archive_link( $object_name ),
    168170                );
    169171            }
     
    199201                    $post_title = sprintf( __( '#%d (no title)' ), $post->ID );
    200202                }
     203
     204                $post_type_label = get_post_type_object( $post->post_type )->labels->singular_name;
     205                $post_states     = get_post_states( $post );
     206                if ( ! empty( $post_states ) ) {
     207                    $post_type_label = implode( ',', $post_states );
     208                }
     209
     210                $title   = html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) );
    201211                $items[] = array(
    202                     'id'         => "post-{$post->ID}",
    203                     'title'      => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ),
    204                     'type'       => 'post_type',
    205                     'type_label' => get_post_type_object( $post->post_type )->labels->singular_name,
    206                     'object'     => $post->post_type,
    207                     'object_id'  => intval( $post->ID ),
    208                     'url'        => get_permalink( intval( $post->ID ) ),
     212                    'id'             => "post-{$post->ID}",
     213                    'title'          => $title,
     214                    'original_title' => $title,
     215                    'type'           => 'post_type',
     216                    'type_label'     => $post_type_label,
     217                    'object'         => $post->post_type,
     218                    'object_id'      => (int) $post->ID,
     219                    'url'            => get_permalink( (int) $post->ID ),
    209220                );
    210221            }
     
    230241
    231242            foreach ( $terms as $term ) {
     243                $title   = html_entity_decode( $term->name, ENT_QUOTES, get_bloginfo( 'charset' ) );
    232244                $items[] = array(
    233                     'id'         => "term-{$term->term_id}",
    234                     'title'      => html_entity_decode( $term->name, ENT_QUOTES, get_bloginfo( 'charset' ) ),
    235                     'type'       => 'taxonomy',
    236                     'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
    237                     'object'     => $term->taxonomy,
    238                     'object_id'  => intval( $term->term_id ),
    239                     'url'        => get_term_link( intval( $term->term_id ), $term->taxonomy ),
     245                    'id'             => "term-{$term->term_id}",
     246                    'title'          => $title,
     247                    'original_title' => $title,
     248                    'type'           => 'taxonomy',
     249                    'type_label'     => get_taxonomy( $term->taxonomy )->labels->singular_name,
     250                    'object'         => $term->taxonomy,
     251                    'object_id'      => (int) $term->term_id,
     252                    'url'            => get_term_link( (int) $term->term_id, $term->taxonomy ),
    240253                );
    241254            }
Note: See TracChangeset for help on using the changeset viewer.