Skip to content

Commit 57d2f00

Browse files
Merge pull request #195 from brainstormforce/codex/migrate-analytics-option-and-add-save-button
Fix advanced settings tab width
2 parents 739b30b + d8aa88b commit 57d2f00

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

index.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public function __construct() {
5050

5151
add_action( 'admin_init', array( $this, 'aiosrs_maybe_migrate_analytics_tracking' ) );
5252

53+
add_action( 'admin_init', array( $this, 'aiosrs_remove_general_usage_tracking_field' ), 15 );
54+
5355
add_filter( 'plugins_loaded', array( $this, 'rich_snippet_translation' ) );
5456
add_action( 'admin_enqueue_scripts', array( $this, 'post_enqueue' ) );
5557
add_action( 'admin_enqueue_scripts', array( $this, 'post_new_enqueue' ) );
@@ -403,6 +405,24 @@ public function aiosrs_maybe_migrate_analytics_tracking() {
403405
}
404406
}
405407
}
408+
409+
/**
410+
* Remove usage tracking checkbox from WordPress General settings.
411+
*
412+
* @since 1.7.2
413+
* @return void
414+
*/
415+
public function aiosrs_remove_general_usage_tracking_field() {
416+
global $wp_settings_fields;
417+
418+
$field_id = 'aiosrs-analytics-optin';
419+
420+
if ( isset( $wp_settings_fields['general']['default'][ $field_id ] ) ) {
421+
unset( $wp_settings_fields['general']['default'][ $field_id ] );
422+
}
423+
424+
unregister_setting( 'general', 'aiosrs_analytics_optin' );
425+
}
406426
}
407427
}
408428
require_once plugin_dir_path( __FILE__ ) . 'functions.php';

0 commit comments

Comments
 (0)