@@ -413,7 +413,7 @@ public function create_item( $request ) {
413
413
414
414
if ( is_wp_error ( $ post_id ) ) {
415
415
416
- if ( in_array ( $ post_id ->get_error_code (), array ( 'db_insert_error ' ) ) ) {
416
+ if ( in_array ( $ post_id ->get_error_code (), array ( 'db_insert_error ' ), true ) ) {
417
417
$ post_id ->add_data ( array ( 'status ' => 500 ) );
418
418
} else {
419
419
$ post_id ->add_data ( array ( 'status ' => 400 ) );
@@ -526,7 +526,7 @@ public function update_item( $request ) {
526
526
// convert the post object to an array, otherwise wp_update_post will expect non-escaped input
527
527
$ post_id = wp_update_post ( (array ) $ post , true );
528
528
if ( is_wp_error ( $ post_id ) ) {
529
- if ( in_array ( $ post_id ->get_error_code (), array ( 'db_update_error ' ) ) ) {
529
+ if ( in_array ( $ post_id ->get_error_code (), array ( 'db_update_error ' ), true ) ) {
530
530
$ post_id ->add_data ( array ( 'status ' => 500 ) );
531
531
} else {
532
532
$ post_id ->add_data ( array ( 'status ' => 400 ) );
@@ -1021,7 +1021,7 @@ protected function handle_featured_media( $featured_media, $post_id ) {
1021
1021
* @param integer $post_id
1022
1022
*/
1023
1023
public function handle_template ( $ template , $ post_id ) {
1024
- if ( in_array ( $ template , array_keys ( wp_get_theme ()->get_page_templates ( $ this ->get_post ( $ post_id ) ) ) ) ) {
1024
+ if ( in_array ( $ template , array_keys ( wp_get_theme ()->get_page_templates ( $ this ->get_post ( $ post_id ) ) ), true ) ) {
1025
1025
update_post_meta ( $ post_id , '_wp_page_template ' , $ template );
1026
1026
} else {
1027
1027
update_post_meta ( $ post_id , '_wp_page_template ' , '' );
@@ -1375,15 +1375,15 @@ protected function prepare_links( $post ) {
1375
1375
),
1376
1376
);
1377
1377
1378
- if ( ( in_array ( $ post ->post_type , array ( 'post ' , 'page ' ) ) || post_type_supports ( $ post ->post_type , 'author ' ) )
1378
+ if ( ( in_array ( $ post ->post_type , array ( 'post ' , 'page ' ), true ) || post_type_supports ( $ post ->post_type , 'author ' ) )
1379
1379
&& ! empty ( $ post ->post_author ) ) {
1380
1380
$ links ['author ' ] = array (
1381
1381
'href ' => rest_url ( 'wp/v2/users/ ' . $ post ->post_author ),
1382
1382
'embeddable ' => true ,
1383
1383
);
1384
1384
};
1385
1385
1386
- if ( in_array ( $ post ->post_type , array ( 'post ' , 'page ' ) ) || post_type_supports ( $ post ->post_type , 'comments ' ) ) {
1386
+ if ( in_array ( $ post ->post_type , array ( 'post ' , 'page ' ), true ) || post_type_supports ( $ post ->post_type , 'comments ' ) ) {
1387
1387
$ replies_url = rest_url ( 'wp/v2/comments ' );
1388
1388
$ replies_url = add_query_arg ( 'post ' , $ post ->ID , $ replies_url );
1389
1389
$ links ['replies ' ] = array (
@@ -1392,7 +1392,7 @@ protected function prepare_links( $post ) {
1392
1392
);
1393
1393
}
1394
1394
1395
- if ( in_array ( $ post ->post_type , array ( 'post ' , 'page ' ) ) || post_type_supports ( $ post ->post_type , 'revisions ' ) ) {
1395
+ if ( in_array ( $ post ->post_type , array ( 'post ' , 'page ' ), true ) || post_type_supports ( $ post ->post_type , 'revisions ' ) ) {
1396
1396
$ links ['version-history ' ] = array (
1397
1397
'href ' => rest_url ( trailingslashit ( $ base ) . $ post ->ID . '/revisions ' ),
1398
1398
);
@@ -1413,7 +1413,7 @@ protected function prepare_links( $post ) {
1413
1413
'embeddable ' => true ,
1414
1414
);
1415
1415
}
1416
- if ( ! in_array ( $ post ->post_type , array ( 'attachment ' , 'nav_menu_item ' , 'revision ' ) ) ) {
1416
+ if ( ! in_array ( $ post ->post_type , array ( 'attachment ' , 'nav_menu_item ' , 'revision ' ), true ) ) {
1417
1417
$ attachments_url = rest_url ( 'wp/v2/media ' );
1418
1418
$ attachments_url = add_query_arg ( 'parent ' , $ post ->ID , $ attachments_url );
1419
1419
$ links ['https://api.w.org/attachment ' ] = array (
@@ -1600,9 +1600,9 @@ public function get_item_schema() {
1600
1600
),
1601
1601
);
1602
1602
foreach ( $ post_type_attributes as $ attribute ) {
1603
- if ( isset ( $ fixed_schemas [ $ this ->post_type ] ) && ! in_array ( $ attribute , $ fixed_schemas [ $ this ->post_type ] ) ) {
1603
+ if ( isset ( $ fixed_schemas [ $ this ->post_type ] ) && ! in_array ( $ attribute , $ fixed_schemas [ $ this ->post_type ], true ) ) {
1604
1604
continue ;
1605
- } elseif ( ! in_array ( $ this ->post_type , array_keys ( $ fixed_schemas ) ) && ! post_type_supports ( $ this ->post_type , $ attribute ) ) {
1605
+ } elseif ( ! in_array ( $ this ->post_type , array_keys ( $ fixed_schemas ), true ) && ! post_type_supports ( $ this ->post_type , $ attribute ) ) {
1606
1606
continue ;
1607
1607
}
1608
1608
0 commit comments