Astra_Addon_Update::v1_8_0()

If any advanced header is using existing breadcrumb layout then set a flag to keep using older version of breadcrumb.


Description


Return

(void)


Source

File: classes/class-astra-addon-update.php

		public static function v1_8_0() {
			$query_args = array(
				'post_type'      => 'astra_adv_header',
				'posts_per_page' => 200, // phpcs:ignore WordPress.WP.PostsPerPage.posts_per_page_posts_per_page
				// Limiting number of posts so that query does not timeout if there are too many posts.
				'fields'         => 'ids',
			);

			$page_headers = new WP_Query( $query_args );
			$layouts      = $page_headers->posts;

			if ( is_array( $layouts ) && ! empty( $layouts ) ) {
				foreach ( $layouts as $key => $layout_id ) {

					$post_meta  = get_post_meta( $layout_id, 'ast-advanced-headers-layout', true );
					$breadcrumb = isset( $post_meta['breadcrumb'] ) ? $post_meta['breadcrumb'] : '';

					if ( 'enabled' === $breadcrumb ) {
						update_post_meta( $layout_id, 'astra-breadcrumb-old', 'true' );
					}
				}
			}

			wp_reset_postdata();
		}

User Contributed Notes

You must log in before being able to contribute a note or feedback.