Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
50.00% covered (danger)
50.00%
1 / 2
100.00% covered (success)
100.00%
1 / 1
CRAP
n/a
0 / 0
wpcom_premium_analytics_simple_stats_settings_fields
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * The Stats settings the Premium Analytics Settings tab offers on WordPress.com Simple.
4 *
5 * @package automattic/jetpack-mu-wpcom
6 */
7
8/**
9 * Keep `admin_bar` and the Reader setting: Simple's Stats ignores `roles`, never counts the logged-in views `count_roles` picks,
10 * and does not ask the WP Consent API, which Simple sites cannot install anyway.
11 *
12 * @since $$next-version$$
13 *
14 * @param string[] $fields The settings the package offers.
15 * @return string[]
16 */
17function wpcom_premium_analytics_simple_stats_settings_fields( $fields ) {
18    return array_values( array_intersect( $fields, array( 'admin_bar', 'wpcom_reader_views_enabled' ) ) );
19}
20
21add_filter( 'jetpack_premium_analytics_stats_settings_fields', 'wpcom_premium_analytics_simple_stats_settings_fields' );