From d948532a7066e4152c451c78dc6339812e22166d Mon Sep 17 00:00:00 2001 From: lithrel Date: Wed, 7 Dec 2022 22:12:26 +0100 Subject: [PATCH] Fix array reset Fix for acceptance tests failing --- page.php | 2 +- single.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/page.php b/page.php index ca68afe6e3..ef3e2e5f7a 100755 --- a/page.php +++ b/page.php @@ -35,7 +35,7 @@ $context = Timber::get_context(); $post = new Post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $page_meta_data = get_post_meta( $post->ID ); -reset( $page_meta_data ); +$page_meta_data = array_map( fn( $v ) => reset( $v ), $page_meta_data ); // Ensure redirect is only performed if we're not already on a tag URL. Because tag.php includes this file. if ( ! is_tag() && RedirectRedirectPages::is_active() ) { diff --git a/single.php b/single.php index 7938a08f22..b99fffbb53 100755 --- a/single.php +++ b/single.php @@ -32,8 +32,8 @@ // Articles block parameters to populate the articles block // p4_take_action_page parameter to populate the take action boxout block // Author override parameter. If this is set then the author profile section will not be displayed. -$page_meta_data = get_post_meta( $post->ID ); -reset( $page_meta_data ); +$page_meta_data = get_post_meta( $post->ID ); +$page_meta_data = array_map( fn( $v ) => reset( $v ), $page_meta_data ); $page_terms_data = get_the_terms( $post, 'p4-page-type' ); $page_terms_data = is_array( $page_terms_data ) ? reset( $page_terms_data ) : null; $context['background_image'] = $page_meta_data['p4_background_image_override'] ?? '';