- Timestamp:
- 04/16/2026 07:22:23 AM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/abilities-api/class-wp-ability.php
r62094 r62238 503 503 * @param callable $callback The callable to invoke. 504 504 * @param mixed $input Optional. The input data for the ability. Default `null`. 505 * @return mixed The result of the callable execution .505 * @return mixed The result of the callable execution, or a `WP_Error` if the callback threw. 506 506 */ 507 507 protected function invoke_callback( callable $callback, $input = null ) { … … 511 511 } 512 512 513 return $callback( ...$args ); 513 try { 514 return $callback( ...$args ); 515 } catch ( Throwable $e ) { 516 return new WP_Error( 517 'ability_callback_exception', 518 sprintf( 519 /* translators: 1: Ability name, 2: Exception message. */ 520 __( 'Ability "%1$s" callback threw an exception: %2$s' ), 521 esc_html( $this->name ), 522 esc_html( $e->getMessage() ) 523 ) 524 ); 525 } 514 526 } 515 527
Note: See TracChangeset
for help on using the changeset viewer.