Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/class-wp-icons-registry-gutenberg.php

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Soean, are those updated in core as well? @t-hamano, we might include this in the icons core sync PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Core has a different validation:
https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/class-wp-icons-registry.php#L127C3-L135C4

So maybe we should sync it back from core into gutenberg?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@t-hamano t-hamano Jul 7, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are changes related to the icon registry that have not yet been committed to the core. These changes should be incorporated into WordPress/wordpress-develop#11559.

I have added similar changes to that PR via WordPress/wordpress-develop@88f1834 as well.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, @t-hamano! I added "no sync required label", this should be good to merge.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function register( $icon_name, $icon_properties ) {
return false;
}

if ( false === strpos( $icon_name, '/' ) ) {
if ( ! str_contains( $icon_name, '/' ) ) {
_doing_it_wrong(
__METHOD__,
__( 'Icon name must be namespaced in the form "collection/icon-name".', 'gutenberg' ),
Expand Down Expand Up @@ -289,7 +289,7 @@ function gutenberg_override_wp_icons_registry() {
// the `core/` namespace onto the Gutenberg registry so they are not lost.
if ( null !== $original_registry ) {
foreach ( $original_registry->get_registered_icons() as $icon ) {
if ( strpos( $icon['name'], 'core/' ) === 0 ) {
if ( str_starts_with( $icon['name'], 'core/' ) ) {
continue;
}
$icon_properties = array( 'label' => $icon['label'] );
Expand Down
6 changes: 3 additions & 3 deletions lib/experimental/knowledge/knowledge.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function wp_knowledge_ensure_default_type_term( int $post_id ): void {
return;
}

if ( 0 === strpos( $post->post_name, 'guideline-' ) ) {
if ( str_starts_with( $post->post_name, 'guideline-' ) ) {
$term_id = wp_knowledge_get_or_create_type_term( 'guideline' );
if ( null !== $term_id ) {
wp_set_object_terms( $post_id, $term_id, 'wp_knowledge_type' );
Expand Down Expand Up @@ -337,7 +337,7 @@ function wp_knowledge_maybe_map_term_label( array $data, string $taxonomy ): arr
* @return string|null Scope key, or null if not a registry scope.
*/
function wp_guideline_scope_from_slug( string $slug ): ?string {
if ( 0 !== strpos( $slug, 'guideline-' ) || 0 === strpos( $slug, 'guideline-block-' ) ) {
if ( ! str_starts_with( $slug, 'guideline-' ) || str_starts_with( $slug, 'guideline-block-' ) ) {
return null;
}

Expand Down Expand Up @@ -383,7 +383,7 @@ function wp_knowledge_guard_guideline_row( $prepared_post, $request ) { // phpcs
}
}

if ( 0 !== strpos( (string) $slug, 'guideline-' ) ) {
if ( ! str_starts_with( (string) $slug, 'guideline-' ) ) {
return $prepared_post;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/experimental/rest-api-overrides.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function gutenberg_boot_allow_auto_draft_in_rest_api() {
foreach ( $post_types as $post_type ) {
$supports_editor = post_type_supports( $post_type->name, 'editor' );
$supports_title = post_type_supports( $post_type->name, 'title' );
$is_wp_core_system = strpos( $post_type->name, 'wp_' ) === 0;
$is_wp_core_system = str_starts_with( $post_type->name, 'wp_' );
$is_attachment = 'attachment' === $post_type->name;

// Only add auto-draft to content post types:
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/rss/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function render_block_core_rss( $attributes ) {
$excerpt = esc_attr( wp_trim_words( $excerpt, $attributes['excerptLength'], ' […]' ) );

// Change existing [...] to […].
if ( '[...]' === substr( $excerpt, -5 ) ) {
if ( str_ends_with( $excerpt, '[...]' ) ) {
$excerpt = substr( $excerpt, 0, -5 ) . '[…]';
}

Expand Down
Loading