diff --git a/classes/addons/gutenberg.php b/classes/addons/gutenberg.php index 1f4fae4..c4a9f2d 100644 --- a/classes/addons/gutenberg.php +++ b/classes/addons/gutenberg.php @@ -107,7 +107,7 @@ private function translate_block_attributes( array $attributes, string $block_na break; case 'core/gallery': $image_ids = []; - if ( !empty( $attributes['ids'] ) ) { + if ( ! empty( $attributes['ids'] ) ) { foreach ( $attributes['ids'] as $image_id ) { $local_id = BEA_CSF_Relations::get_object_for_any( 'attachment', @@ -118,7 +118,7 @@ private function translate_block_attributes( array $attributes, string $block_na ); } } - if ( isset( $local_id ) && ! empty( $local_id ) ) { + if ( ! empty( $local_id ) ) { $image_ids[] = $local_id; } $attributes['ids'] = $image_ids; diff --git a/classes/addons/yoast-seo.php b/classes/addons/yoast-seo.php index 0705031..8e5582a 100644 --- a/classes/addons/yoast-seo.php +++ b/classes/addons/yoast-seo.php @@ -23,19 +23,17 @@ public function __construct() { * @author Alexandre Sadowski */ public function bea_set_yoast_seo_meta( array $data, $sync_fields, WP_Post $new_post ) { - $fb_image_meta = isset($data['meta_data']['_yoast_wpseo_opengraph-image-id']) ? $data['meta_data']['_yoast_wpseo_opengraph-image-id'] : null; - if ( ! empty( $fb_image_meta ) && isset( $fb_image_meta[0] ) ) { + $fb_image_meta = isset( $data['meta_data']['_yoast_wpseo_opengraph-image-id'] ) ? $data['meta_data']['_yoast_wpseo_opengraph-image-id'] : null; + if ( is_array( $fb_image_meta ) ) { $fb_seo_id = (int) BEA_CSF_Relations::get_object_for_any( 'attachment', $data['blogid'], $sync_fields['_current_receiver_blog_id'], $fb_image_meta[0], $fb_image_meta[0] ); - if ( ! empty( $fb_seo_id ) && (int) $fb_seo_id > 0 ) { update_post_meta( $new_post->ID, '_yoast_wpseo_opengraph-image-id', (string) $fb_seo_id ); } } - $twitter_image_meta = isset($data['meta_data']['_yoast_wpseo_twitter-image-id']) ? $data['meta_data']['_yoast_wpseo_twitter-image-id'] : null; - if ( ! empty( $twitter_image_meta ) && isset( $twitter_image_meta[0] ) ) { + $twitter_image_meta = isset( $data['meta_data']['_yoast_wpseo_twitter-image-id'] ) ? $data['meta_data']['_yoast_wpseo_twitter-image-id'] : null; + if ( is_array( $twitter_image_meta ) ) { $twitter_seo_id = (int) BEA_CSF_Relations::get_object_for_any( 'attachment', $data['blogid'], $sync_fields['_current_receiver_blog_id'], $twitter_image_meta[0], $twitter_image_meta[0] ); - if ( ! empty( $twitter_seo_id ) && (int) $twitter_seo_id > 0 ) { update_post_meta( $new_post->ID, '_yoast_wpseo_twitter-image-id', (string) $twitter_seo_id ); }