Skip to content

Commit

Permalink
I18N: Move code out of a translatable string in `WP_REST_Posts_Contro…
Browse files Browse the repository at this point in the history
…ller::get_item_schema()`.

Props ramiy.
Fixes #50759.

git-svn-id: https://develop.svn.wordpress.org/trunk@48610 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Jul 25, 2020
1 parent 56c30a4 commit 5edc4e9
Showing 1 changed file with 10 additions and 1 deletion.
Expand Up @@ -2192,6 +2192,7 @@ public function get_item_schema() {
'custom-fields',
),
);

foreach ( $post_type_attributes as $attribute ) {
if ( isset( $fixed_schemas[ $this->post_type ] ) && ! in_array( $attribute, $fixed_schemas[ $this->post_type ], true ) ) {
continue;
Expand Down Expand Up @@ -2424,7 +2425,15 @@ public function get_item_schema() {
// Emit a _doing_it_wrong warning if user tries to add new properties using this filter.
$new_fields = array_diff( array_keys( $schema['properties'] ), $schema_fields );
if ( count( $new_fields ) > 0 ) {
_doing_it_wrong( __METHOD__, __( 'Please use register_rest_field to add new schema properties.' ), '5.4.0' );
_doing_it_wrong(
__METHOD__,
sprintf(
/* translators: %s: register_rest_field */
__( 'Please use %s to add new schema properties.' ),
'<code>register_rest_field<code>'
),
'5.4.0'
);
}

$this->schema = $schema;
Expand Down

0 comments on commit 5edc4e9

Please sign in to comment.