learndash_header_data

apply_filters( 'learndash_header_data',  array $header_data,  string $menu_tab_key,  array $admin_tab_sets )

Filters Learndash menu header data.


Description #

May be used to localize dynamic data to LearnDashData global at front-end.


Parameters #

$header_data

(array) Menu header data.

$menu_tab_key

(string) Menu tab key.

$admin_tab_sets

(array) An array of admin tab sets data.


Source #

File: includes/admin/class-learndash-admin-menus-tabs.php


Examples #

 <?php
/**
 * Example usage for learndash_header_data filter.
 */
add_filter(
	'learndash_header_data',
	function( $header_data, $menu_tab_key, $admin_tab_sets ) {
		if ( isset( $header_data['tabs'] ) ) {
			foreach ( $header_data['tabs'] as $tab_idx => $tab ) {
				if ( ( isset( $tab['id'] ) ) && ( 'learndash_course_groups' === $tab['id'] ) ) {
					unset( $header_data['tabs'][ $tab_idx ] );
				}
			}
		}

		return $header_data;
	},
	30,
	3
);

add_filter(
	'learndash_header_data',
	function( $header_data = array(), $menu_tab_key = '', $tab_sets = array() ) {
		if ( ( isset( $header_data['tabs'] ) ) && ( ! empty( $header_data['tabs'] ) ) ) {
			foreach ( $header_data['tabs'] as $tab_idx => $tab ) {
				if ( ( isset( $tab['id'] ) ) && ( 'admin_page_nss_plugin_license-sfwd_lms-settings' === $tab['id'] ) ) {
					unset( $header_data['tabs'][ $tab_idx ] );
				}
			}
		}

		// Always return $header_data.
		return $header_data;
	},
	30,
	3
);