Make WordPress Core

Changeset 62401 for trunk


Ignore:
Timestamp:
05/21/2026 10:27:38 AM (5 months ago)
Author:
gziolo
Message:

Abilities API: Stop HTML-escaping the ability name in WP_Error messages

Ability names are pattern-validated at registration, so esc_html() on them is always a no-op. Drop it from the WP_Error messages, which are commonly serialized to JSON where the escaping would be incorrect.

Follow-up to [62398].
See #64311.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/abilities-api/class-wp-ability.php

    r62398 r62401  
    562562                                        /* translators: 1: Ability name, 2: Exception message. */
    563563                                        __( 'Ability "%1$s" callback threw an exception: %2$s' ),
    564                                         esc_html( $this->name ),
     564                                        $this->name,
    565565                                        esc_html( $e->getMessage() )
    566566                                )
    … …  
    591591                                'ability_invalid_permission_callback',
    592592                                /* translators: %s ability name. */
    593                                 sprintf( __( 'Ability "%s" does not have a valid permission callback.' ), esc_html( $this->name ) )
     593                                sprintf( __( 'Ability "%s" does not have a valid permission callback.' ), $this->name )
    594594                        );
    595595                }
    … …  
    639639                                'ability_invalid_execute_callback',
    640640                                /* translators: %s ability name. */
    641                                 sprintf( __( 'Ability "%s" does not have a valid execute callback.' ), esc_html( $this->name ) )
     641                                sprintf( __( 'Ability "%s" does not have a valid execute callback.' ), $this->name )
    642642                        );
    643643                } else {
    … …  
    784784                                'ability_invalid_permissions',
    785785                                /* translators: %s ability name. */
    786                                 sprintf( __( 'Ability "%s" does not have necessary permission.' ), esc_html( $this->name ) )
     786                                sprintf( __( 'Ability "%s" does not have necessary permission.' ), $this->name )
    787787                        );
    788788                }
Note: See TracChangeset for help on using the changeset viewer.