Hide the AffiliateWP license key field

Hide the AffiliateWP license key field on child sites.

Snippet Type

Execute on Child Sites

Snippet

function am_affwp_hide_license_key_field() {

	$screen = get_current_screen();

	if ( $screen->id !== 'affiliates_page_affiliate-wp-settings' ) {
		return;
	}

	$first_tab = false;

	if (
		isset( $_GET['page'] ) && 'affiliate-wp-settings' === $_GET['page'] && ! isset( $_GET['tab'] ) ||
		isset( $_GET['page'] ) && 'affiliate-wp-settings' === $_GET['page'] && isset( $_GET['tab'] ) && 'general' === $_GET['tab']
	) {
		$first_tab = true;
	}

	if ( ! $first_tab ) {
		return;
	}

	?>
	<style>.affiliates_page_affiliate-wp-settings .form-table tr:nth-child(-n+2) { display: none; }</style>
	<?php
}
add_action( 'admin_head', 'am_affwp_hide_license_key_field' );
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.