diff --git a/functions.php b/functions.php index 4781aeaa3c..128435744b 100644 --- a/functions.php +++ b/functions.php @@ -414,7 +414,9 @@ function render_navigation_block(array $attributes): string // For parent pages, get the previous and next siblings in the menu order $output = ''; $siblings = array_filter($menu_items, function ($item) use ($nav_menu_item) { - return $item->menu_item_parent === $nav_menu_item->menu_item_parent; + return $item !== null + && $nav_menu_item !== null + && $item->menu_item_parent === $nav_menu_item->menu_item_parent; }); $siblings = array_values($siblings); @@ -435,7 +437,7 @@ function render_navigation_block(array $attributes): string // For child pages, only show link to the parent if ($submenu_page->menu_item_parent !== 0) { $parent_item = array_filter($menu_items, function ($item) use ($submenu_page) { - return (int) $item->ID === (int) $submenu_page->menu_item_parent; + return $submenu_page !== null && (int) $item->ID === (int) $submenu_page->menu_item_parent; }); $parent_item = reset($parent_item); diff --git a/src/GravityFormsExtensions.php b/src/GravityFormsExtensions.php index 947daa9248..9c27bd1149 100644 --- a/src/GravityFormsExtensions.php +++ b/src/GravityFormsExtensions.php @@ -676,11 +676,11 @@ public function p4_gf_clear_page_caches(array $form, bool $is_new = false): void /** * Client side dynamic population of form fields * - * @param array $form The different form fields present + * @param array|bool $form The different form fields present * * @return mixed */ - public function p4_client_side_gravityforms_prefill(array $form): array + public function p4_client_side_gravityforms_prefill($form): array { $supported_field_types = ['GF_Field_Hidden']; diff --git a/src/Migrations/M032MigrateSplit2ColumnBlock.php b/src/Migrations/M032MigrateSplit2ColumnBlock.php index b3219f5164..7633dfc844 100644 --- a/src/Migrations/M032MigrateSplit2ColumnBlock.php +++ b/src/Migrations/M032MigrateSplit2ColumnBlock.php @@ -222,9 +222,9 @@ private static function get_split_2_columns_block_attrs(array $block): array $block_attrs['column1']['title'] = $block['title'] ?? ''; $block_attrs['column1']['description'] = wp_trim_words($block['issue_description'] ?? '', 12); $block_attrs['column1']['link_text'] = $block['issue_link_text'] ?? ''; - $block_attrs['column1']['link_path'] = $block['issue_link_path'] ?? ''; + $block_attrs['column1']['link_path'] = (string)$block['issue_link_path'] ?? ''; $block_attrs['column1']['image_id'] = $block['issue_image_id'] ?? ''; - $block_attrs['column1']['image_src'] = $block['issue_image_src'] ?? ''; + $block_attrs['column1']['image_src'] = (string)$block['issue_image_src'] ?? ''; $block_attrs['column2']['title'] = $block['tag_name'] ?? ''; $block_attrs['column2']['description'] = wp_trim_words($block['tag_description'] ?? '', 12); @@ -232,7 +232,7 @@ private static function get_split_2_columns_block_attrs(array $block): array $block_attrs['column2']['button_link'] = $block['button_link'] ?? ''; $block_attrs['column2']['link_path'] = $block['tag_link'] ?? ''; $block_attrs['column2']['image_id'] = $block['tag_image_id'] ?? ''; - $block_attrs['column2']['image_src'] = $block['tag_image_src'] ?? ''; + $block_attrs['column2']['image_src'] = (string)$block['tag_image_src'] ?? ''; return $block_attrs; } diff --git a/tag.php b/tag.php index 30b56973f7..2fdbfbcea7 100644 --- a/tag.php +++ b/tag.php @@ -20,11 +20,11 @@ } $tag = get_queried_object(); -$redirect_id = get_term_meta($tag->term_id, 'redirect_page', true); +$redirect_id = $tag !== null && get_term_meta($tag->term_id, 'redirect_page', true); +$redirect_page = get_post($redirect_id); -if ($redirect_id) { +if ($redirect_page) { global $wp_query; - $redirect_page = get_post($redirect_id); $wp_query->queried_object = $redirect_page; $wp_query->queried_object_id = $redirect_page->ID;