Astra_Ext_Advanced_Headers_Meta::retain_currnt_tab( String $location )

Add query arg for the current tab.


Description

This is only added if we are on the ‘astra_adv_header’ post type edit screen.


Parameters

$location

(String) (Required) URL where the page is redirected after post is saved.


Return

(String) Redirect URL with the added query arg for the current tab.


Source

File: addons/advanced-headers/classes/class-astra-ext-advanced-headers-meta.php

		public function retain_currnt_tab( $location ) {

			// bail early if we are on any different post type.
			if ( 'astra_adv_header' !== get_post_type() || ! is_admin() ) {
				return $location;
			}

			if ( isset( $_POST['advanced_header_post_update'] ) && wp_verify_nonce( $_POST['advanced_header_post_update'], 'advanced_header_post_update' ) ) {

				$current_tab = isset( $_POST['advanced-headers-current-tab'] ) ? esc_attr( $_POST['advanced-headers-current-tab'] ) : '';

				if ( '' !== $current_tab ) {
					$location = add_query_arg(
						array(
							'current-tab' => $current_tab,
						),
						$location
					);
				}
			}

			return $location;
		}

Changelog

Changelog
Version Description
1.0.0 Introduced.

User Contributed Notes

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