PluginProbe ʕ •ᴥ•ʔ
Admin and Site Enhancements (ASE) / 3.7.0
Admin and Site Enhancements (ASE) v3.7.0
9.1.1 9.1.0 9.0.2 9.0.1 9.0.0 8.9.2 8.9.1 8.9.0 8.8.8 8.8.7 8.8.6 8.8.5 8.8.4 8.8.3 8.8.2 8.8.1 8.8.0 8.7.3 8.7.2 8.7.1 8.2.1 8.2.2 8.2.3 8.3.0 8.3.1 8.3.2 8.4.0 8.4.1 8.4.2 8.5.0 8.5.1 8.5.2 8.6.0 8.6.1 8.6.2 8.7.0 5.0.1 5.0.2 5.0.2.1 5.0.2.2 5.0.2.3 5.0.2.4 5.1.0 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1 5.5.0 5.5.1 5.5.2 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.8.0 5.8.1 6.0.0 6.0.3 6.0.4 6.0.5 6.0.5.1 6.0.6 6.0.7 6.0.8.1 6.1.0 6.1.3 6.2.0 6.2.1 6.2.2 6.2.3 6.2.4 6.2.5 6.2.6 6.2.7 6.3.0 6.3.1 6.3.2 6.4.0 6.5.0 6.5.1 6.6.0 6.7.0 6.8.0 6.8.2 6.8.3 6.9.0 6.9.1 6.9.10 6.9.11 6.9.12 6.9.13.1 6.9.13.2 6.9.2 6.9.3 6.9.4 6.9.5 6.9.6 6.9.7 6.9.8 6.9.9 7.0.0 7.0.2 7.0.2.1 7.0.2.2 7.0.2.3 7.0.3 7.1.0 7.1.1 7.1.2 7.1.3 7.1.4 7.1.5 7.2.0 7.2.1 7.3.0 7.3.1 7.3.2 7.3.3 7.4.0 7.4.2 7.4.4 7.4.5 7.4.6 7.4.7 7.4.8 7.5.0 7.5.1 7.5.2 7.5.3 7.5.4 7.6.0 7.6.1 7.6.1.1 7.6.10 7.6.11 7.6.2 7.6.3 7.6.4 7.6.5 7.6.6 7.6.7 7.6.7.1 7.6.8 7.6.9 7.7.0 7.8.0 7.8.1 7.8.10 7.8.11 7.8.12 7.8.13 7.8.14 7.8.15 7.8.16 7.8.17 7.8.18 7.8.2 7.8.3 7.8.4 7.8.5 7.8.5.1 7.8.6 7.8.7 7.8.8 7.8.9 7.9.0 7.9.1 7.9.10 7.9.11 7.9.2 7.9.3 7.9.4 7.9.5 7.9.6 7.9.7 7.9.8 7.9.9 8.0.0 8.0.1 8.0.2 8.0.3 8.0.4 8.0.5 8.0.6 8.0.7 8.0.8 8.1.0 8.1.1 8.1.2 8.1.3 8.1.4 8.2.0 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 1.9.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.2.0 3.3.0 3.4.0 3.5.0 3.6.1 3.7.0 3.8.0 3.9.0 3.9.1 3.9.2 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.8.0 4.8.1 4.8.2 4.8.3 4.9.0 4.9.1 4.9.2 4.9.3 5.0.0
admin-site-enhancements / classes / class-settings-sections-fields.php
admin-site-enhancements / classes Last commit date
class-activation.php 3 years ago class-admin-interface.php 3 years ago class-common-methods.php 3 years ago class-content-management.php 3 years ago class-custom-code.php 3 years ago class-deactivation.php 3 years ago class-disable-components.php 3 years ago class-login-logout.php 3 years ago class-security.php 3 years ago class-settings-fields-render.php 3 years ago class-settings-sanitization.php 3 years ago class-settings-sections-fields.php 3 years ago class-utilities.php 3 years ago
class-settings-sections-fields.php
1519 lines
1 <?php
2
3 namespace ASENHA\Classes;
4
5 /**
6 * Class related to registration of settings fields
7 *
8 * @since 2.2.0
9 */
10 class Settings_Sections_Fields {
11
12 /**
13 * Register plugin settings and the corresponding fields
14 *
15 * @link https://wpshout.com/making-an-admin-options-page-with-the-wordpress-settings-api/
16 * @link https://rudrastyh.com/wordpress/creating-options-pages.html
17 * @since 1.0.0
18 */
19 function register_sections_fields() {
20
21 add_settings_section(
22 'main-section', // Section ID
23 '', // Section title. Can be blank.
24 '', // Callback function to output section intro. Can be blank.
25 ASENHA_SLUG // Settings page slug
26 );
27
28 // Register main setttings
29
30 // Instantiate object for sanitization of settings fields values
31 $sanitization = new Settings_Sanitization;
32
33 // Instantiate object for rendering of settings fields for the admin page
34 $render_field = new Settings_Fields_Render;
35
36 register_setting(
37 ASENHA_ID, // Option group or option_page
38 ASENHA_SLUG_U, // Option name in wp_options table
39 array(
40 'type' => 'array', // 'string', 'boolean', 'integer', 'number', 'array', or 'object'
41 'description' => '', // A description of the data attached to this setting.
42 'sanitize_callback' => [ $sanitization, 'sanitize_for_options' ],
43 'show_in_rest' => false,
44 'default' => array(), // When calling get_option()
45 )
46 );
47
48 // Call WordPress globals required for the fields
49
50 global $wp_roles, $wpdb, $asenha_public_post_types, $asenha_gutenberg_post_types, $asenha_revisions_post_types;
51
52 $roles = $wp_roles->get_names();
53
54 // Get array of slugs and plural labels for public post types, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
55 $asenha_public_post_types = array();
56 $public_post_type_names = get_post_types( array( 'public' => true ), 'names' );
57 foreach( $public_post_type_names as $post_type_name ) {
58 $post_type_object = get_post_type_object( $post_type_name );
59 $asenha_public_post_types[$post_type_name] = $post_type_object->label;
60 }
61
62 // Get array of slugs and plural labels for post types that can be edited with the Gutenberg block editor, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
63 $asenha_gutenberg_post_types = array();
64 $gutenberg_not_applicable_types = array( 'attachment', 'revision', 'nav_menu_item', 'custom_css', 'customize_changeset', 'oembed_cache', 'user_request', 'wp_block' );
65 $all_post_types = get_post_types( array(), 'objects' );
66 foreach ( $all_post_types as $post_type_slug => $post_type_info ) {
67 $asenha_gutenberg_post_types[$post_type_slug] = $post_type_info->label;
68 if ( in_array( $post_type_slug, $gutenberg_not_applicable_types ) ) {
69 unset( $asenha_gutenberg_post_types[$post_type_slug] );
70 }
71 }
72
73 // Get array of slugs and plural labels for post types supporting revisions, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
74 $asenha_revisions_post_types = array();
75 foreach ( get_post_types( array(), 'names' ) as $post_type_slug ) { // post type slug/name
76 if ( post_type_supports( $post_type_slug, 'revisions' ) ) {
77 $post_type_object = get_post_type_object( $post_type_slug );
78 if ( property_exists( $post_type_object, 'label' ) ) {
79 $asenha_revisions_post_types[$post_type_slug] = $post_type_object->label;
80 }
81 }
82 }
83
84
85 // =================================================================
86 // CONTENT MANAGEMENT
87 // =================================================================
88
89 // Enable Page and Post Duplication
90
91 $field_id = 'enable_duplication';
92 $field_slug = 'enable-duplication';
93
94 add_settings_field(
95 $field_id, // Field ID
96 'Enable Page and Post Duplication', // Field title
97 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
98 ASENHA_SLUG, // Settings page slug
99 'main-section', // Section ID
100 array(
101 'field_id' => $field_id, // Custom argument
102 'field_slug' => $field_slug, // Custom argument
103 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
104 'field_description' => 'Enable one-click duplication of pages, posts and custom posts. The corresponding taxonomy terms and post meta will also be duplicated.', // Custom argument
105 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
106 )
107 );
108
109 // Enable Media Replacement
110
111 $field_id = 'enable_media_replacement';
112 $field_slug = 'enable-media-replacement';
113
114 add_settings_field(
115 $field_id, // Field ID
116 'Enable Media Replacement', // Field title
117 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
118 ASENHA_SLUG, // Settings page slug
119 'main-section', // Section ID
120 array(
121 'field_id' => $field_id, // Custom argument
122 'field_slug' => $field_slug, // Custom argument
123 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
124 'field_description' => 'Easily replace any type of media file with a new one while retaining the existing media ID, publish date and file name. So, no existing links will break.', // Custom argument
125 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
126 )
127 );
128
129 // Enable SVG Upload
130
131 $field_id = 'enable_svg_upload';
132 $field_slug = 'enable-svg-upload';
133
134 add_settings_field(
135 $field_id, // Field ID
136 'Enable SVG Upload', // Field title
137 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
138 ASENHA_SLUG, // Settings page slug
139 'main-section', // Section ID
140 array(
141 'field_id' => $field_id, // Custom argument
142 'field_slug' => $field_slug, // Custom argument
143 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
144 'field_description' => 'Allow some or all user roles to upload SVG files, which will then be sanitized to keep things secure.', // Custom argument
145 'field_options_wrapper' => true, // Custom argument. Add container for additional options
146 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
147 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
148 )
149 );
150
151 $field_id = 'enable_svg_upload_for';
152 $field_slug = 'enable-svg-upload-for';
153
154 if ( is_array( $roles ) ) {
155 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
156
157 add_settings_field(
158 $field_id . '_' . $role_slug, // Field ID
159 '', // Field title
160 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
161 ASENHA_SLUG, // Settings page slug
162 'main-section', // Section ID
163 array(
164 'parent_field_id' => $field_id, // Custom argument
165 'field_id' => $role_slug, // Custom argument
166 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
167 'field_label' => $role_label, // Custom argument
168 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
169 )
170 );
171
172 }
173 }
174
175 // Enable Revisions Control
176
177 $field_id = 'enable_revisions_control';
178 $field_slug = 'enable-revisions-control';
179
180 add_settings_field(
181 $field_id, // Field ID
182 'Enable Revisions Control', // Field title
183 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
184 ASENHA_SLUG, // Settings page slug
185 'main-section', // Section ID
186 array(
187 'field_id' => $field_id, // Custom argument
188 'field_slug' => $field_slug, // Custom argument
189 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
190 'field_description' => 'Prevent bloating the database by limiting the number of revisions to keep for some or all post types supporting revisions.', // Custom argument
191 'field_options_wrapper' => true, // Custom argument. Add container for additional options
192 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
193 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
194 )
195 );
196
197 $field_id = 'revisions_max_number';
198 $field_slug = 'revisions-max-number';
199
200 add_settings_field(
201 $field_id, // Field ID
202 '', // Field title
203 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
204 ASENHA_SLUG, // Settings page slug
205 'main-section', // Section ID
206 array(
207 'field_id' => $field_id, // Custom argument
208 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
209 'field_type' => 'with-prefix-suffix', // Custom argument
210 'field_prefix' => 'Limit to', // Custom argument
211 'field_suffix' => 'revisions for:', // Custom argument
212 'field_intro' => '', // Custom argument
213 'field_description' => '', // Custom argument
214 'class' => 'asenha-number asenha-hide-th extra-narrow content-management ' . $field_slug, // Custom class for the <tr> element
215 )
216 );
217
218 $field_id = 'enable_revisions_control_for';
219 $field_slug = 'enable-revisions-control-for';
220
221 if ( is_array( $asenha_revisions_post_types ) ) {
222 foreach ( $asenha_revisions_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts
223 add_settings_field(
224 $field_id . '_' . $post_type_slug, // Field ID
225 '', // Field title
226 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
227 ASENHA_SLUG, // Settings page slug
228 'main-section', // Section ID
229 array(
230 'parent_field_id' => $field_id, // Custom argument
231 'field_id' => $post_type_slug, // Custom argument
232 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $post_type_slug . ']', // Custom argument
233 'field_label' => $post_type_label . ' <span class="faded">('. $post_type_slug .')</span>', // Custom argument
234 'class' => 'asenha-checkbox asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug, // Custom class for the <tr> element
235 )
236 );
237 }
238 }
239
240 // Enable Auto-Publishing of Posts with Missed Schedules
241
242 $field_id = 'enable_missed_schedule_posts_auto_publish';
243 $field_slug = 'enable-missed-schedule-posts-auto-publish';
244
245 add_settings_field(
246 $field_id, // Field ID
247 'Enable Auto-Publishing of Posts with Missed Schedule', // Field title
248 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
249 ASENHA_SLUG, // Settings page slug
250 'main-section', // Section ID
251 array(
252 'field_id' => $field_id, // Custom argument
253 'field_slug' => $field_slug, // Custom argument
254 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
255 'field_description' => 'Trigger publishing of scheduled posts of all types marked with "missed schedule", anytime the site is visited.', // Custom argument
256 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
257 )
258 );
259
260
261 // Enhance List Tables
262
263 $field_id = 'enhance_list_tables';
264 $field_slug = 'enhance-list-tables';
265
266 add_settings_field(
267 $field_id, // Field ID
268 'Enhance List Tables', // Field title
269 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
270 ASENHA_SLUG, // Settings page slug
271 'main-section', // Section ID
272 array(
273 'field_id' => $field_id, // Custom argument
274 'field_slug' => $field_slug, // Custom argument
275 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
276 'field_description' => 'Improve the usefulness of listing pages of various post types by adding / removing columns and elements.', // Custom argument
277 'field_options_wrapper' => true, // Custom argument. Add container for additional options
278 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
279 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
280 )
281 );
282
283 // Show Featured Image Column
284
285 $field_id = 'show_featured_image_column';
286 $field_slug = 'show-featured-image-column';
287
288 add_settings_field(
289 $field_id, // Field ID
290 '', // Field title
291 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
292 ASENHA_SLUG, // Settings page slug
293 'main-section', // Section ID
294 array(
295 'field_id' => $field_id, // Custom argument
296 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
297 'field_label' => 'Show featured image column.', // Custom argument
298 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
299 )
300 );
301
302 // Show Excerpt Column
303
304 $field_id = 'show_excerpt_column';
305 $field_slug = 'show-excerpt-column';
306
307 add_settings_field(
308 $field_id, // Field ID
309 '', // Field title
310 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
311 ASENHA_SLUG, // Settings page slug
312 'main-section', // Section ID
313 array(
314 'field_id' => $field_id, // Custom argument
315 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
316 'field_label' => 'Show excerpt column.', // Custom argument
317 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
318 )
319 );
320
321 // Show ID Column
322
323 $field_id = 'show_id_column';
324 $field_slug = 'show-id-column';
325
326 add_settings_field(
327 $field_id, // Field ID
328 '', // Field title
329 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
330 ASENHA_SLUG, // Settings page slug
331 'main-section', // Section ID
332 array(
333 'field_id' => $field_id, // Custom argument
334 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
335 'field_label' => 'Show ID column.', // Custom argument
336 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
337 )
338 );
339
340 // Hide Comments Column
341
342 $field_id = 'hide_comments_column';
343 $field_slug = 'hide-comments-column';
344
345 add_settings_field(
346 $field_id, // Field ID
347 '', // Field title
348 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
349 ASENHA_SLUG, // Settings page slug
350 'main-section', // Section ID
351 array(
352 'field_id' => $field_id, // Custom argument
353 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
354 'field_label' => 'Remove comments column.', // Custom argument
355 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
356 )
357 );
358
359 // Hide Post Tags Column
360
361 $field_id = 'hide_post_tags_column';
362 $field_slug = 'hide-post-tags-column';
363
364 add_settings_field(
365 $field_id, // Field ID
366 '', // Field title
367 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
368 ASENHA_SLUG, // Settings page slug
369 'main-section', // Section ID
370 array(
371 'field_id' => $field_id, // Custom argument
372 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
373 'field_label' => 'Remove tags column (for posts).', // Custom argument
374 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
375 )
376 );
377
378 // Show Custom Taxonomy Filters
379
380 $field_id = 'show_custom_taxonomy_filters';
381 $field_slug = 'show-custom-taxonomy-filters';
382
383 add_settings_field(
384 $field_id, // Field ID
385 '', // Field title
386 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
387 ASENHA_SLUG, // Settings page slug
388 'main-section', // Section ID
389 array(
390 'field_id' => $field_id, // Custom argument
391 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
392 'field_label' => 'Show additional filter(s) for hierarchical, custom taxonomies.', // Custom argument
393 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
394 )
395 );
396
397 // =================================================================
398 // ADMIN INTERFACE
399 // =================================================================
400
401 // Hide Admin Notices
402
403 $field_id = 'hide_admin_notices';
404 $field_slug = 'hide-admin-notices';
405
406 add_settings_field(
407 $field_id, // Field ID
408 'Hide Admin Notices', // Field title
409 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
410 ASENHA_SLUG, // Settings page slug
411 'main-section', // Section ID
412 array(
413 'field_id' => $field_id, // Custom argument
414 'field_slug' => $field_slug, // Custom argument
415 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
416 'field_description' => 'Clean up admin pages by moving notices into a separate panel easily accessible via the admin bar.', // Custom argument
417 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
418 )
419 );
420
421 // View Admin as Role
422
423 $field_id = 'view_admin_as_role';
424 $field_slug = 'view-admin-as-role';
425
426 add_settings_field(
427 $field_id, // Field ID
428 'View Admin as Role', // Field title
429 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
430 ASENHA_SLUG, // Settings page slug
431 'main-section', // Section ID
432 array(
433 'field_id' => $field_id, // Custom argument
434 'field_slug' => $field_slug, // Custom argument
435 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
436 'field_description' => 'View admin pages and the site (logged-in) as one of the non-administrator user roles.', // Custom argument
437 'field_options_wrapper' => true, // Custom argument. Add container for additional options
438 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
439 )
440 );
441
442 // Hide or Modify Elements
443
444 $field_id = 'hide_modify_elements';
445 $field_slug = 'hide-modify-elements';
446
447 add_settings_field(
448 $field_id, // Field ID
449 'Clean Up Admin Bar', // Field title
450 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
451 ASENHA_SLUG, // Settings page slug
452 'main-section', // Section ID
453 array(
454 'field_id' => $field_id, // Custom argument
455 'field_slug' => $field_slug, // Custom argument
456 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
457 'field_description' => 'Remove various elements from the admin bar.', // Custom argument
458 'field_options_wrapper' => true, // Custom argument. Add container for additional options
459 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
460 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
461 )
462 );
463
464 $field_id = 'hide_ab_wp_logo_menu';
465 $field_slug = 'hide-ab-wp-logo-menu';
466
467 add_settings_field(
468 $field_id, // Field ID
469 '', // Field title
470 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
471 ASENHA_SLUG, // Settings page slug
472 'main-section', // Section ID
473 array(
474 'field_id' => $field_id, // Custom argument
475 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
476 'field_label' => 'Remove WordPress logo/menu', // Custom argument
477 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
478 )
479 );
480
481 $field_id = 'hide_ab_customize_menu';
482 $field_slug = 'hide-ab-customize-menu';
483
484 add_settings_field(
485 $field_id, // Field ID
486 '', // Field title
487 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
488 ASENHA_SLUG, // Settings page slug
489 'main-section', // Section ID
490 array(
491 'field_id' => $field_id, // Custom argument
492 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
493 'field_label' => 'Remove customize menu', // Custom argument
494 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
495 )
496 );
497
498 $field_id = 'hide_ab_updates_menu';
499 $field_slug = 'hide-ab-updates-menu';
500
501 add_settings_field(
502 $field_id, // Field ID
503 '', // Field title
504 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
505 ASENHA_SLUG, // Settings page slug
506 'main-section', // Section ID
507 array(
508 'field_id' => $field_id, // Custom argument
509 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
510 'field_label' => 'Remove updates counter/link', // Custom argument
511 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
512 )
513 );
514
515 $field_id = 'hide_ab_comments_menu';
516 $field_slug = 'hide-ab-comments-menu';
517
518 add_settings_field(
519 $field_id, // Field ID
520 '', // Field title
521 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
522 ASENHA_SLUG, // Settings page slug
523 'main-section', // Section ID
524 array(
525 'field_id' => $field_id, // Custom argument
526 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
527 'field_label' => 'Remove comments counter/link', // Custom argument
528 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
529 )
530 );
531
532 $field_id = 'hide_ab_new_content_menu';
533 $field_slug = 'hide-ab-new-content-menu';
534
535 add_settings_field(
536 $field_id, // Field ID
537 '', // Field title
538 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
539 ASENHA_SLUG, // Settings page slug
540 'main-section', // Section ID
541 array(
542 'field_id' => $field_id, // Custom argument
543 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
544 'field_label' => 'Remove new content menu', // Custom argument
545 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
546 )
547 );
548
549 $field_id = 'hide_ab_howdy';
550 $field_slug = 'hide-ab-howdy';
551
552 add_settings_field(
553 $field_id, // Field ID
554 '', // Field title
555 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
556 ASENHA_SLUG, // Settings page slug
557 'main-section', // Section ID
558 array(
559 'field_id' => $field_id, // Custom argument
560 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
561 'field_label' => 'Remove \'Howdy\'', // Custom argument
562 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
563 )
564 );
565
566 // Hide Admin Bar
567
568 $field_id = 'hide_admin_bar';
569 $field_slug = 'hide-admin-bar';
570
571 add_settings_field(
572 $field_id, // Field ID
573 'Hide Admin Bar', // Field title
574 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
575 ASENHA_SLUG, // Settings page slug
576 'main-section', // Section ID
577 array(
578 'field_id' => $field_id, // Custom argument
579 'field_slug' => $field_slug, // Custom argument
580 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
581 'field_description' => 'Hide admin bar on the front end for all or some user roles.', // Custom argument
582 'field_options_wrapper' => true, // Custom argument. Add container for additional options
583 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
584 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
585 )
586 );
587
588 $field_id = 'hide_admin_bar_for';
589 $field_slug = 'hide-admin-bar-for';
590
591 if ( is_array( $roles ) ) {
592 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
593
594 add_settings_field(
595 $field_id . '_' . $role_slug, // Field ID
596 '', // Field title
597 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
598 ASENHA_SLUG, // Settings page slug
599 'main-section', // Section ID
600 array(
601 'parent_field_id' => $field_id, // Custom argument
602 'field_id' => $role_slug, // Custom argument
603 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
604 'field_label' => $role_label, // Custom argument
605 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
606 )
607 );
608
609 }
610 }
611
612 // Customize Admin Menu
613
614 $field_id = 'customize_admin_menu';
615 $field_slug = 'customize-admin-menu';
616
617 add_settings_field(
618 $field_id, // Field ID
619 'Admin Menu Organizer', // Field title
620 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
621 ASENHA_SLUG, // Settings page slug
622 'main-section', // Section ID
623 array(
624 'field_id' => $field_id, // Custom argument
625 'field_slug' => $field_slug, // Custom argument
626 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
627 'field_description' => 'Customize the order of the admin menu and optionally change menu item title or hide some items.', // Custom argument
628 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
629 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
630 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
631 )
632 );
633
634 $field_id = 'custom_menu_order';
635 $field_slug = 'custom-menu-order';
636
637 add_settings_field(
638 $field_id, // Field ID
639 '', // Field title
640 [ $render_field, 'render_sortable_menu' ], // Callback to render field with custom arguments in the array below
641 ASENHA_SLUG, // Settings page slug
642 'main-section', // Section ID
643 array(
644 'field_id' => $field_id, // Custom argument
645 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
646 'field_type' => 'sortable-menu', // Custom argument
647 'field_description' => '', // Custom argument
648 'class' => 'asenha-sortable asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
649 )
650 );
651
652 // =================================================================
653 // LOG IN | LOG OUT
654 // =================================================================
655
656 // Change Login URL
657
658 $field_id = 'change_login_url';
659 $field_slug = 'change-login-url';
660
661 add_settings_field(
662 $field_id, // Field ID
663 'Change Login URL', // Field title
664 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
665 ASENHA_SLUG, // Settings page slug
666 'main-section', // Section ID
667 array(
668 'field_id' => $field_id, // Custom argument
669 'field_slug' => $field_slug, // Custom argument
670 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
671 'field_description' => 'Default is ' . get_site_url() . '/wp-admin/', // Custom argument
672 'field_options_wrapper' => true, // Custom argument. Add container for additional options
673 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
674 )
675 );
676
677 $field_id = 'custom_login_slug';
678 $field_slug = 'custom-login-slug';
679
680 add_settings_field(
681 $field_id, // Field ID
682 'New URL:', // Field title
683 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
684 ASENHA_SLUG, // Settings page slug
685 'main-section', // Section ID
686 array(
687 'field_id' => $field_id, // Custom argument
688 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
689 'field_type' => 'with-prefix-suffix', // Custom argument
690 'field_prefix' => get_site_url() . '/', // Custom argument
691 'field_suffix' => '/', // Custom argument
692 'field_description' => '', // Custom argument
693 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug, // Custom class for the <tr> element
694 )
695 );
696
697 // Enable Log In/Out Menu
698
699 $field_id = 'enable_login_logout_menu';
700 $field_slug = 'enable-login-logout-menu';
701
702 add_settings_field(
703 $field_id, // Field ID
704 'Enable Log In/Out Menu', // Field title
705 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
706 ASENHA_SLUG, // Settings page slug
707 'main-section', // Section ID
708 array(
709 'field_id' => $field_id, // Custom argument
710 'field_slug' => $field_slug, // Custom argument
711 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
712 'field_description' => 'Enable log in, log out and dynamic log in/out menu item for addition to any menu.', // Custom argument
713 'field_options_wrapper' => true, // Custom argument. Add container for additional options
714 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
715 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
716 )
717 );
718
719 // Enable Last Login Column
720
721 $field_id = 'enable_last_login_column';
722 $field_slug = 'enable-last-login-column';
723
724 add_settings_field(
725 $field_id, // Field ID
726 'Enable Last Login Column', // Field title
727 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
728 ASENHA_SLUG, // Settings page slug
729 'main-section', // Section ID
730 array(
731 'field_id' => $field_id, // Custom argument
732 'field_slug' => $field_slug, // Custom argument
733 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
734 'field_description' => 'Log when users on the site last logged in and display the date and time in the users list table.', // Custom argument
735 'field_options_wrapper' => true, // Custom argument. Add container for additional options
736 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
737 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
738 )
739 );
740
741 // Redirect After Login
742
743 $field_id = 'redirect_after_login';
744 $field_slug = 'redirect-after-login';
745
746 add_settings_field(
747 $field_id, // Field ID
748 'Redirect After Login', // Field title
749 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
750 ASENHA_SLUG, // Settings page slug
751 'main-section', // Section ID
752 array(
753 'field_id' => $field_id, // Custom argument
754 'field_slug' => $field_slug, // Custom argument
755 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
756 'field_description' => 'Set custom redirect URL for all or some user roles after login.', // Custom argument
757 'field_options_wrapper' => true, // Custom argument. Add container for additional options
758 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
759 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
760 )
761 );
762
763 $field_id = 'redirect_after_login_to_slug';
764 $field_slug = 'redirect-after-login-to-slug';
765
766 add_settings_field(
767 $field_id, // Field ID
768 'Redirect to:', // Field title
769 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
770 ASENHA_SLUG, // Settings page slug
771 'main-section', // Section ID
772 array(
773 'field_id' => $field_id, // Custom argument
774 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
775 'field_type' => 'with-prefix-suffix', // Custom argument
776 'field_prefix' => get_site_url() . '/', // Custom argument
777 'field_suffix' => '/ for:', // Custom argument
778 'field_description' => '', // Custom argument
779 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug, // Custom class for the <tr> element
780 )
781 );
782
783 $field_id = 'redirect_after_login_for';
784 $field_slug = 'redirect-after-login-for';
785
786 if ( is_array( $roles ) ) {
787 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
788
789 add_settings_field(
790 $field_id . '_' . $role_slug, // Field ID
791 '', // Field title
792 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
793 ASENHA_SLUG, // Settings page slug
794 'main-section', // Section ID
795 array(
796 'parent_field_id' => $field_id, // Custom argument
797 'field_id' => $role_slug, // Custom argument
798 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
799 'field_label' => $role_label, // Custom argument
800 'class' => 'asenha-checkbox asenha-hide-th asenha-half login-logout ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
801 )
802 );
803
804 }
805 }
806
807 // Redirect After Logout
808
809 $field_id = 'redirect_after_logout';
810 $field_slug = 'redirect-after-logout';
811
812 add_settings_field(
813 $field_id, // Field ID
814 'Redirect After Logout', // Field title
815 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
816 ASENHA_SLUG, // Settings page slug
817 'main-section', // Section ID
818 array(
819 'field_id' => $field_id, // Custom argument
820 'field_slug' => $field_slug, // Custom argument
821 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
822 'field_description' => 'Set custom redirect URL for all or some user roles after logout.', // Custom argument
823 'field_options_wrapper' => true, // Custom argument. Add container for additional options
824 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
825 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
826 )
827 );
828
829 $field_id = 'redirect_after_logout_to_slug';
830 $field_slug = 'redirect-after-logout-to-slug';
831
832 add_settings_field(
833 $field_id, // Field ID
834 'Redirect to:', // Field title
835 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
836 ASENHA_SLUG, // Settings page slug
837 'main-section', // Section ID
838 array(
839 'field_id' => $field_id, // Custom argument
840 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
841 'field_type' => 'with-prefix-suffix', // Custom argument
842 'field_prefix' => get_site_url() . '/', // Custom argument
843 'field_suffix' => '/ for:', // Custom argument
844 'field_description' => '', // Custom argument
845 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug, // Custom class for the <tr> element
846 )
847 );
848
849 $field_id = 'redirect_after_logout_for';
850 $field_slug = 'redirect-after-logout-for';
851
852 if ( is_array( $roles ) ) {
853 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
854
855 add_settings_field(
856 $field_id . '_' . $role_slug, // Field ID
857 '', // Field title
858 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
859 ASENHA_SLUG, // Settings page slug
860 'main-section', // Section ID
861 array(
862 'parent_field_id' => $field_id, // Custom argument
863 'field_id' => $role_slug, // Custom argument
864 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
865 'field_label' => $role_label, // Custom argument
866 'class' => 'asenha-checkbox asenha-hide-th asenha-half login-logout ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
867 )
868 );
869
870 }
871 }
872
873 // =================================================================
874 // CUSTOM CODE
875 // =================================================================
876
877 // Enable Custom Admin CSS
878
879 $field_id = 'enable_custom_admin_css';
880 $field_slug = 'enable-custom-admin-css';
881
882 add_settings_field(
883 $field_id, // Field ID
884 'Enable Custom Admin CSS', // Field title
885 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
886 ASENHA_SLUG, // Settings page slug
887 'main-section', // Section ID
888 array(
889 'field_id' => $field_id, // Custom argument
890 'field_slug' => $field_slug, // Custom argument
891 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
892 'field_description' => 'Add custom CSS on all admin pages for all user roles.', // Custom argument
893 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
894 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
895 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
896 )
897 );
898
899 $field_id = 'custom_admin_css';
900 $field_slug = 'custom-admin-css';
901
902 add_settings_field(
903 $field_id, // Field ID
904 '', // Field title
905 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
906 ASENHA_SLUG, // Settings page slug
907 'main-section', // Section ID
908 array(
909 'field_id' => $field_id, // Custom argument
910 'field_slug' => $field_slug, // Custom argument
911 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
912 'field_type' => 'textarea', // Custom argument
913 'field_intro' => '', // Custom argument
914 'field_description' => '', // Custom argument
915 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
916 )
917 );
918
919 // Enable Custom Frontend CSS
920
921 $field_id = 'enable_custom_frontend_css';
922 $field_slug = 'enable-custom-frontend-css';
923
924 add_settings_field(
925 $field_id, // Field ID
926 'Enable Custom Frontend CSS', // Field title
927 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
928 ASENHA_SLUG, // Settings page slug
929 'main-section', // Section ID
930 array(
931 'field_id' => $field_id, // Custom argument
932 'field_slug' => $field_slug, // Custom argument
933 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
934 'field_description' => 'Add custom CSS on all frontend pages for all user roles.', // Custom argument
935 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
936 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
937 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
938 )
939 );
940
941 $field_id = 'custom_frontend_css';
942 $field_slug = 'custom-frontend-css';
943
944 add_settings_field(
945 $field_id, // Field ID
946 '', // Field title
947 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
948 ASENHA_SLUG, // Settings page slug
949 'main-section', // Section ID
950 array(
951 'field_id' => $field_id, // Custom argument
952 'field_slug' => $field_slug, // Custom argument
953 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
954 'field_type' => 'textarea', // Custom argument
955 'field_intro' => '', // Custom argument
956 'field_description' => '', // Custom argument
957 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
958 )
959 );
960
961 // Manage ads.txt and app-ads.txt
962
963 $field_id = 'manage_ads_appads_txt';
964 $field_slug = 'manage-ads-appads-txt';
965
966 add_settings_field(
967 $field_id, // Field ID
968 'Manage ads.txt and app-ads.txt', // Field title
969 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
970 ASENHA_SLUG, // Settings page slug
971 'main-section', // Section ID
972 array(
973 'field_id' => $field_id, // Custom argument
974 'field_slug' => $field_slug, // Custom argument
975 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
976 'field_description' => 'Easily edit and validate your <a href="/ads.txt" target="_blank">ads.txt</a> and <a href="/app-ads.txt" target="_blank">app-ads.txt</a> content.', // Custom argument
977 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
978 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
979 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
980 )
981 );
982
983 $field_id = 'ads_txt_content';
984 $field_slug = 'ads-txt-content';
985
986 add_settings_field(
987 $field_id, // Field ID
988 '', // Field title
989 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
990 ASENHA_SLUG, // Settings page slug
991 'main-section', // Section ID
992 array(
993 'field_id' => $field_id, // Custom argument
994 'field_slug' => $field_slug, // Custom argument
995 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
996 'field_type' => 'textarea', // Custom argument
997 'field_intro' => '<strong>Your ads.txt content:</strong>', // Custom argument
998 'field_description' => 'Validate with: <a href="https://adstxt.guru/validator/url/?url=' . urlencode( get_site_url( null, 'ads.txt' ) ) . '" target="_blank">adstxt.guru</a> | <a href="https://www.adstxtvalidator.com/ads_txt/' . esc_attr( str_replace( '.', '-', $_SERVER['SERVER_NAME'] ) ) . '" target="_blank">adstxtvalidator.com</a><div class="vspacer"></div>', // Custom argument
999 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1000 )
1001 );
1002
1003 $field_id = 'app_ads_txt_content';
1004 $field_slug = 'app-ads-txt-content';
1005
1006 add_settings_field(
1007 $field_id, // Field ID
1008 '', // Field title
1009 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1010 ASENHA_SLUG, // Settings page slug
1011 'main-section', // Section ID
1012 array(
1013 'field_id' => $field_id, // Custom argument
1014 'field_slug' => $field_slug, // Custom argument
1015 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1016 'field_type' => 'textarea', // Custom argument
1017 'field_intro' => '<strong>Your app-ads.txt content:</strong>', // Custom argument
1018 'field_description' => 'Validate with: <a href="https://adstxt.guru/validator/url/?url=' . urlencode( get_site_url( null, 'app-ads.txt' ) ) . '" target="_blank">adstxt.guru</a>', // Custom argument
1019 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1020 )
1021 );
1022
1023 // Manage robots.txt
1024
1025 $field_id = 'manage_robots_txt';
1026 $field_slug = 'manage-robots-txt';
1027
1028 add_settings_field(
1029 $field_id, // Field ID
1030 'Manage robots.txt', // Field title
1031 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1032 ASENHA_SLUG, // Settings page slug
1033 'main-section', // Section ID
1034 array(
1035 'field_id' => $field_id, // Custom argument
1036 'field_slug' => $field_slug, // Custom argument
1037 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1038 'field_description' => 'Easily edit and validate your <a href="/robots.txt" target="_blank">robots.txt</a> content.', // Custom argument
1039 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
1040 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1041 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
1042 )
1043 );
1044
1045 $field_id = 'robots_txt_content';
1046 $field_slug = 'robots-txt-content';
1047
1048 add_settings_field(
1049 $field_id, // Field ID
1050 '', // Field title
1051 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1052 ASENHA_SLUG, // Settings page slug
1053 'main-section', // Section ID
1054 array(
1055 'field_id' => $field_id, // Custom argument
1056 'field_slug' => $field_slug, // Custom argument
1057 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1058 'field_type' => 'textarea', // Custom argument
1059 'field_intro' => '', // Custom argument
1060 'field_description' => 'Validate with: <a href="https://en.ryte.com/free-tools/robots-txt/?refresh=1&url=' . urlencode( get_site_url( null, 'robots.txt' ) ) . '&useragent=Googlebot&submit=Evaluate" target="_blank">ryte.com</a> | <a href="https://serp.tools/tools/robots-txt" target="_blank">serp.tools</a><div class="vspacer"></div>', // Custom argument
1061 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1062 )
1063 );
1064
1065 // Insert <head>, <body> and <footer> code
1066
1067 $field_id = 'insert_head_body_footer_code';
1068 $field_slug = 'insert-head-body-footer-code';
1069
1070 add_settings_field(
1071 $field_id, // Field ID
1072 'Insert &lt;head&gt;, &lt;body&gt; and &lt;footer&gt; Code', // Field title
1073 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1074 ASENHA_SLUG, // Settings page slug
1075 'main-section', // Section ID
1076 array(
1077 'field_id' => $field_id, // Custom argument
1078 'field_slug' => $field_slug, // Custom argument
1079 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1080 'field_description' => 'Easily insert &lt;meta&gt;, &lt;link&gt;, &lt;script&gt; and &lt;style&gt; tags, Google Analytics, Tag Manager, AdSense, Ads Conversion and Optimize code, Facebook, TikTok and Twitter pixels, etc.', // Custom argument
1081 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
1082 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1083 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
1084 )
1085 );
1086
1087 $field_id = 'head_code_priority';
1088 $field_slug = 'head-code-priority';
1089
1090 add_settings_field(
1091 $field_id, // Field ID
1092 '', // Field title
1093 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
1094 ASENHA_SLUG, // Settings page slug
1095 'main-section', // Section ID
1096 array(
1097 'field_id' => $field_id, // Custom argument
1098 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1099 'field_type' => 'with-prefix-suffix', // Custom argument
1100 'field_prefix' => '<strong>Code to insert before &lt;/head&gt; with the priority of</strong>', // Custom argument
1101 'field_suffix' => '', // Custom argument
1102 'field_intro' => '', // Custom argument
1103 'field_description' => 'Default is 10. Larger number insert code closer to &lt;/head&gt;', // Custom argument
1104 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug, // Custom class for the <tr> element
1105 )
1106 );
1107
1108 $field_id = 'head_code';
1109 $field_slug = 'head-code';
1110
1111 add_settings_field(
1112 $field_id, // Field ID
1113 '', // Field title
1114 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1115 ASENHA_SLUG, // Settings page slug
1116 'main-section', // Section ID
1117 array(
1118 'field_id' => $field_id, // Custom argument
1119 'field_slug' => $field_slug, // Custom argument
1120 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1121 'field_type' => 'textarea', // Custom argument
1122 'field_intro' => '', // Custom argument
1123 'field_description' => '', // Custom argument
1124 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1125 )
1126 );
1127
1128 $field_id = 'body_code_priority';
1129 $field_slug = 'body-code-priority';
1130
1131 add_settings_field(
1132 $field_id, // Field ID
1133 '', // Field title
1134 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
1135 ASENHA_SLUG, // Settings page slug
1136 'main-section', // Section ID
1137 array(
1138 'field_id' => $field_id, // Custom argument
1139 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1140 'field_type' => 'with-prefix-suffix', // Custom argument
1141 'field_prefix' => '<strong>Code to insert after &lt;body&gt; with the priority of</strong>', // Custom argument
1142 'field_suffix' => '', // Custom argument
1143 'field_intro' => '', // Custom argument
1144 'field_description' => 'Default is 10. Smaller number insert code closer to &lt;body&gt;', // Custom argument
1145 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug, // Custom class for the <tr> element
1146 )
1147 );
1148
1149 $field_id = 'body_code';
1150 $field_slug = 'body-code';
1151
1152 add_settings_field(
1153 $field_id, // Field ID
1154 '', // Field title
1155 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1156 ASENHA_SLUG, // Settings page slug
1157 'main-section', // Section ID
1158 array(
1159 'field_id' => $field_id, // Custom argument
1160 'field_slug' => $field_slug, // Custom argument
1161 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1162 'field_type' => 'textarea', // Custom argument
1163 'field_intro' => '', // Custom argument
1164 'field_description' => '', // Custom argument
1165 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1166 )
1167 );
1168
1169 $field_id = 'footer_code_priority';
1170 $field_slug = 'footer-code-priority';
1171
1172 add_settings_field(
1173 $field_id, // Field ID
1174 '', // Field title
1175 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
1176 ASENHA_SLUG, // Settings page slug
1177 'main-section', // Section ID
1178 array(
1179 'field_id' => $field_id, // Custom argument
1180 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1181 'field_type' => 'with-prefix-suffix', // Custom argument
1182 'field_prefix' => '<strong>Code to insert in footer section before &lt;/body&gt;: with the priority of</strong>', // Custom argument
1183 'field_suffix' => '', // Custom argument
1184 'field_intro' => '', // Custom argument
1185 'field_description' => 'Default is 10. Larger number insert code closer to &lt;/body&gt;', // Custom argument
1186 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug, // Custom class for the <tr> element
1187 )
1188 );
1189
1190 $field_id = 'footer_code';
1191 $field_slug = 'footer-code';
1192
1193 add_settings_field(
1194 $field_id, // Field ID
1195 '', // Field title
1196 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1197 ASENHA_SLUG, // Settings page slug
1198 'main-section', // Section ID
1199 array(
1200 'field_id' => $field_id, // Custom argument
1201 'field_slug' => $field_slug, // Custom argument
1202 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1203 'field_type' => 'textarea', // Custom argument
1204 'field_intro' => '', // Custom argument
1205 'field_description' => '', // Custom argument
1206 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1207 )
1208 );
1209
1210 // =================================================================
1211 // DISABLE COMPONENTS
1212 // =================================================================
1213
1214 // Disable Gutenberg
1215
1216 $field_id = 'disable_gutenberg';
1217 $field_slug = 'disable-gutenberg';
1218
1219 add_settings_field(
1220 $field_id, // Field ID
1221 'Disable Gutenberg', // Field title
1222 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1223 ASENHA_SLUG, // Settings page slug
1224 'main-section', // Section ID
1225 array(
1226 'field_id' => $field_id, // Custom argument
1227 'field_slug' => $field_slug, // Custom argument
1228 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1229 'field_description' => 'Disable the Gutenberg block editor for some or all applicable post types.', // Custom argument
1230 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1231 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1232 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
1233 )
1234 );
1235
1236 $field_id = 'disable_gutenberg_for';
1237 $field_slug = 'disable-gutenberg-for';
1238
1239 if ( is_array( $asenha_gutenberg_post_types ) ) {
1240 foreach ( $asenha_gutenberg_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts
1241 add_settings_field(
1242 $field_id . '_' . $post_type_slug, // Field ID
1243 '', // Field title
1244 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
1245 ASENHA_SLUG, // Settings page slug
1246 'main-section', // Section ID
1247 array(
1248 'parent_field_id' => $field_id, // Custom argument
1249 'field_id' => $post_type_slug, // Custom argument
1250 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $post_type_slug . ']', // Custom argument
1251 'field_label' => $post_type_label . ' <span class="faded">('. $post_type_slug .')</span>', // Custom argument
1252 'class' => 'asenha-checkbox asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug, // Custom class for the <tr> element
1253 )
1254 );
1255 }
1256 }
1257
1258 $field_id = 'disable_gutenberg_frontend_styles';
1259 $field_slug = 'disable-gutenberg-frontend-styles';
1260
1261 add_settings_field(
1262 $field_id, // Field ID
1263 '', // Field title
1264 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
1265 ASENHA_SLUG, // Settings page slug
1266 'main-section', // Section ID
1267 array(
1268 'field_id' => $field_id, // Custom argument
1269 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1270 'field_label' => 'Also disable frontend block styles / CSS files for the selected post types.', // Custom argument
1271 'class' => 'asenha-checkbox asenha-hide-th asenha-th-border-top disable-components ' . $field_slug, // Custom class for the <tr> element
1272 )
1273 );
1274
1275 // Disable Comments
1276
1277 $field_id = 'disable_comments';
1278 $field_slug = 'disable-comments';
1279
1280 add_settings_field(
1281 $field_id, // Field ID
1282 'Disable Comments', // Field title
1283 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1284 ASENHA_SLUG, // Settings page slug
1285 'main-section', // Section ID
1286 array(
1287 'field_id' => $field_id, // Custom argument
1288 'field_slug' => $field_slug, // Custom argument
1289 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1290 'field_description' => 'Disable comments for some or all public post types. When disabled, existing comments will also be hidden on the frontend.', // Custom argument
1291 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1292 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1293 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
1294 )
1295 );
1296
1297 $field_id = 'disable_comments_for';
1298 $field_slug = 'disable-comments-for';
1299
1300 if ( is_array( $asenha_public_post_types ) ) {
1301 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts
1302 add_settings_field(
1303 $field_id . '_' . $post_type_slug, // Field ID
1304 '', // Field title
1305 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
1306 ASENHA_SLUG, // Settings page slug
1307 'main-section', // Section ID
1308 array(
1309 'parent_field_id' => $field_id, // Custom argument
1310 'field_id' => $post_type_slug, // Custom argument
1311 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $post_type_slug . ']', // Custom argument
1312 'field_label' => $post_type_label . ' <span class="faded">('. $post_type_slug .')</span>', // Custom argument
1313 'class' => 'asenha-checkbox asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug, // Custom class for the <tr> element
1314 )
1315 );
1316 }
1317 }
1318
1319 // Disable REST API
1320
1321 $field_id = 'disable_rest_api';
1322 $field_slug = 'disable-rest-api';
1323
1324 add_settings_field(
1325 $field_id, // Field ID
1326 'Disable REST API', // Field title
1327 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1328 ASENHA_SLUG, // Settings page slug
1329 'main-section', // Section ID
1330 array(
1331 'field_id' => $field_id, // Custom argument
1332 'field_slug' => $field_slug, // Custom argument
1333 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1334 'field_description' => 'Disable REST API access for non-authenticated users and remove URL traces from &lt;head&gt;, HTTP headers and WP RSD endpoint.', // Custom argument
1335 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1336 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1337 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
1338 )
1339 );
1340
1341 // Disable Feeds
1342
1343 $field_id = 'disable_feeds';
1344 $field_slug = 'disable-feeds';
1345
1346 add_settings_field(
1347 $field_id, // Field ID
1348 'Disable Feeds', // Field title
1349 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1350 ASENHA_SLUG, // Settings page slug
1351 'main-section', // Section ID
1352 array(
1353 'field_id' => $field_id, // Custom argument
1354 'field_slug' => $field_slug, // Custom argument
1355 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1356 'field_description' => 'Disable all RSS, Atom and RDF feeds. This includes feeds for posts, categories, tags, comments, authors and search. Also removes traces of feed URLs from &lt;head&gt;.', // Custom argument
1357 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1358 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1359 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
1360 )
1361 );
1362
1363 // =================================================================
1364 // SECURITY
1365 // =================================================================
1366
1367 // Limit Login Attempts
1368
1369 $field_id = 'limit_login_attempts';
1370 $field_slug = 'limit-login-attempts';
1371
1372 add_settings_field(
1373 $field_id, // Field ID
1374 'Limit Login Attempts', // Field title
1375 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1376 ASENHA_SLUG, // Settings page slug
1377 'main-section', // Section ID
1378 array(
1379 'field_id' => $field_id, // Custom argument
1380 'field_slug' => $field_slug, // Custom argument
1381 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1382 'field_description' => 'Prevent brute force attacks by limiting the number of failed login attempts allowed per IP address.', // Custom argument
1383 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1384 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1385 'class' => 'asenha-toggle security ' . $field_slug, // Custom class for the <tr> element
1386 )
1387 );
1388
1389 $field_id = 'login_fails_allowed';
1390 $field_slug = 'login-fails-allowed';
1391
1392 add_settings_field(
1393 $field_id, // Field ID
1394 '', // Field title
1395 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
1396 ASENHA_SLUG, // Settings page slug
1397 'main-section', // Section ID
1398 array(
1399 'field_id' => $field_id, // Custom argument
1400 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1401 'field_type' => 'with-prefix-suffix', // Custom argument
1402 'field_prefix' => '', // Custom argument
1403 'field_suffix' => 'failed login attempts allowed before 15 minutes lockout', // Custom argument
1404 'field_description' => '', // Custom argument
1405 'class' => 'asenha-text with-prefix-suffix narrow no-margin security ' . $field_slug, // Custom class for the <tr> element
1406 )
1407 );
1408
1409 $field_id = 'login_lockout_maxcount';
1410 $field_slug = 'login-lockout-maxcount';
1411
1412 add_settings_field(
1413 $field_id, // Field ID
1414 '', // Field title
1415 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
1416 ASENHA_SLUG, // Settings page slug
1417 'main-section', // Section ID
1418 array(
1419 'field_id' => $field_id, // Custom argument
1420 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1421 'field_type' => 'with-prefix-suffix', // Custom argument
1422 'field_prefix' => '', // Custom argument
1423 'field_suffix' => 'lockout(s) will block further login attempts for 24 hours', // Custom argument
1424 'field_description' => '', // Custom argument
1425 'class' => 'asenha-text with-prefix-suffix narrow no-margin security ' . $field_slug, // Custom class for the <tr> element
1426 )
1427 );
1428
1429 $field_id = 'login_attempts_log_table';
1430 $field_slug = 'login-attempts-log-table';
1431
1432 add_settings_field(
1433 $field_id, // Field ID
1434 '', // Field title
1435 [ $render_field, 'render_datatable' ], // Callback to render field with custom arguments in the array below
1436 ASENHA_SLUG, // Settings page slug
1437 'main-section', // Section ID
1438 array(
1439 'field_id' => $field_id, // Custom argument
1440 'field_slug' => $field_slug, // Custom argument
1441 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1442 'field_type' => 'datatable', // Custom argument
1443 'field_description' => '', // Custom argument
1444 'class' => 'asenha-text datatable asenha-hide-th security ' . $field_slug, // Custom class for the <tr> element
1445 'table_title' => 'Failed Login Attempts Log',
1446 'table_name' => $wpdb->prefix . 'asenha_failed_logins',
1447 )
1448 );
1449
1450 // Obfuscate Author Slugs
1451
1452 $field_id = 'obfuscate_author_slugs';
1453 $field_slug = 'obfuscate-author-slugs';
1454
1455 add_settings_field(
1456 $field_id, // Field ID
1457 'Obfuscate Author Slugs', // Field title
1458 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1459 ASENHA_SLUG, // Settings page slug
1460 'main-section', // Section ID
1461 array(
1462 'field_id' => $field_id, // Custom argument
1463 'field_slug' => $field_slug, // Custom argument
1464 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1465 'field_description' => 'Obfuscate publicly exposed author page URLs that shows the user slugs / usernames, e.g. <em>sitename.com/author/username1/</em> into <em>sitename.com/author/a6r5b8ytu9gp34bv/</em>, and output 404 errors for the original URLs. Also obfuscates in /wp-json/wp/v2/users/ REST API endpoint.', // Custom argument
1466 'field_options_wrapper' => false, // Custom argument. Add container for additional options
1467 'class' => 'asenha-toggle security ' . $field_slug, // Custom class for the <tr> element
1468 )
1469 );
1470
1471 // Disable XML-RPC
1472
1473 $field_id = 'disable_xmlrpc';
1474 $field_slug = 'disable-xmlrpc';
1475
1476 add_settings_field(
1477 $field_id, // Field ID
1478 'Disable XML-RPC', // Field title
1479 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1480 ASENHA_SLUG, // Settings page slug
1481 'main-section', // Section ID
1482 array(
1483 'field_id' => $field_id, // Custom argument
1484 'field_slug' => $field_slug, // Custom argument
1485 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1486 'field_description' => 'Protect your site from brute force, DOS and DDOS attacks via <a href="https://kinsta.com/blog/xmlrpc-php/#what-is-xmlrpcphp" target="_blank">XML-RPC</a>. Also disables trackbacks and pingbacks. ', // Custom argument
1487 'field_options_wrapper' => false, // Custom argument. Add container for additional options
1488 'class' => 'asenha-toggle security ' . $field_slug, // Custom class for the <tr> element
1489 )
1490 );
1491
1492 // =================================================================
1493 // UTILITIES
1494 // =================================================================
1495
1496 // Redirect 404 to Homepage
1497
1498 $field_id = 'redirect_404_to_homepage';
1499 $field_slug = 'redirect-404-to-homepage';
1500
1501 add_settings_field(
1502 $field_id, // Field ID
1503 'Redirect 404 to Homepage', // Field title
1504 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1505 ASENHA_SLUG, // Settings page slug
1506 'main-section', // Section ID
1507 array(
1508 'field_id' => $field_id, // Custom argument
1509 'field_slug' => $field_slug, // Custom argument
1510 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1511 'field_description' => 'Perform 301 (permanent) redirect to the homepage for all 404 (not found) pages.', // Custom argument
1512 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1513 'class' => 'asenha-toggle utilities ' . $field_slug, // Custom class for the <tr> element
1514 )
1515 );
1516
1517 }
1518
1519 }