Skip to content

Commit 986b723

Browse files
committed
fix(Rest): use check_method for description property access
Replace direct $model->description access with check_method getter/property fallback to prevent PHP 8.2+ dynamic property deprecation notices and potential fatal errors on non-public description properties.
1 parent b6bbc58 commit 986b723

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Rest/ModelsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ private function prepare_model_for_response( $model, WP_REST_Request $request ):
286286
'label_singular' => $this->check_method( $model, 'get_label_singular', 'one', '' ),
287287
'label_plural' => $this->check_method( $model, 'get_label_plural', 'many', '' ),
288288
'featured_image' => $this->check_method( $model, 'get_featured_image_label', 'featured_image', '' ),
289-
'description' => $model->description ?? '',
289+
'description' => $this->check_method( $model, 'get_description', 'description', '' ),
290290
'is_public' => $options['public'] ?? true,
291291
'show_in_rest' => $options['show_in_rest'] ?? true,
292292
'rest_base' => method_exists( $model, 'get_rest_base' ) ? $model->get_rest_base() : ( $options['rest_base'] ?? $this->check_method( $model, 'get_registration_name', 'name', '' ) ),

0 commit comments

Comments
 (0)