PluginProbe ʕ •ᴥ•ʔ
Admin and Site Enhancements (ASE) / 6.3.2
Admin and Site Enhancements (ASE) v6.3.2
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-admin-interface.php
admin-site-enhancements / classes Last commit date
class-activation.php 2 years ago class-admin-interface.php 2 years ago class-common-methods.php 2 years ago class-content-management.php 2 years ago class-custom-code.php 2 years ago class-deactivation.php 2 years ago class-disable-components.php 2 years ago class-login-logout.php 2 years ago class-optimizations.php 2 years ago class-security.php 2 years ago class-settings-fields-render.php 2 years ago class-settings-sanitization.php 2 years ago class-settings-sections-fields.php 2 years ago class-utilities.php 2 years ago
class-admin-interface.php
1292 lines
1 <?php
2
3 namespace ASENHA\Classes;
4
5 use WP_Admin_Bar ;
6 use ArrayObject ;
7 use NumberFormatter ;
8 /**
9 * Class related to Admin Interface features
10 *
11 * @since 1.2.0
12 */
13 class Admin_Interface
14 {
15 /**
16 * Modify admin bar menu for Admin Interface >> Hide or Modify Elements feature
17 *
18 * @param $wp_admin_bar object The admin bar.
19 * @since 1.9.0
20 */
21 public function modify_admin_bar_menu( $wp_admin_bar )
22 {
23 $options = get_option( ASENHA_SLUG_U, array() );
24 // Hide WP Logo Menu
25
26 if ( array_key_exists( 'hide_ab_wp_logo_menu', $options ) && $options['hide_ab_wp_logo_menu'] ) {
27 remove_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
28 // priority needs to match default value. Use QM to reference.
29 }
30
31 // Hide Customize Menu
32
33 if ( array_key_exists( 'hide_ab_customize_menu', $options ) && $options['hide_ab_customize_menu'] ) {
34 remove_action( 'admin_bar_menu', 'wp_admin_bar_customize_menu', 40 );
35 // priority needs to match default value. Use QM to reference.
36 }
37
38 // Hide Updates Counter/Link
39
40 if ( array_key_exists( 'hide_ab_updates_menu', $options ) && $options['hide_ab_updates_menu'] ) {
41 remove_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 50 );
42 // priority needs to match default value. Use QM to reference.
43 }
44
45 // Hide Comments Counter/Link
46
47 if ( array_key_exists( 'hide_ab_comments_menu', $options ) && $options['hide_ab_comments_menu'] ) {
48 remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
49 // priority needs to match default value. Use QM to reference.
50 }
51
52 // Hide New Content Menu
53
54 if ( array_key_exists( 'hide_ab_new_content_menu', $options ) && $options['hide_ab_new_content_menu'] ) {
55 remove_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 70 );
56 // priority needs to match default value. Use QM to reference.
57 }
58
59 // Hide 'Howdy' text
60
61 if ( array_key_exists( 'hide_ab_howdy', $options ) && $options['hide_ab_howdy'] ) {
62 // Remove the whole my account sectino and later rebuild it
63 remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_item', 7 );
64 $current_user = wp_get_current_user();
65 $user_id = get_current_user_id();
66 $profile_url = get_edit_profile_url( $user_id );
67 $avatar = get_avatar( $user_id, 26 );
68 // size 26x26 pixels
69 $display_name = $current_user->display_name;
70 $class = 'with-avatar';
71 $wp_admin_bar->add_menu( array(
72 'id' => 'my-account',
73 'parent' => 'top-secondary',
74 'title' => $display_name . $avatar,
75 'href' => $profile_url,
76 'meta' => array(
77 'class' => $class,
78 ),
79 ) );
80 }
81
82 }
83
84 /**
85 * Wrapper for admin notices being output on admin screens
86 *
87 * @since 1.2.0
88 */
89 public function admin_notices_wrapper()
90 {
91 $options = get_option( ASENHA_SLUG_U, array() );
92 $hide_for_nonadmins = ( isset( $options['hide_admin_notices_for_nonadmins'] ) ? $options['hide_admin_notices_for_nonadmins'] : false );
93
94 if ( $hide_for_nonadmins && bwasenha_fs()->can_use_premium_code__premium_only() ) {
95 $minimum_capability = 'read';
96 } else {
97 $minimum_capability = 'manage_options';
98 }
99
100 if ( current_user_can( $minimum_capability ) ) {
101 echo '<div class="asenha-admin-notices-drawer" style="display:none;"><h2>Admin Notices</h2></div>' ;
102 }
103 }
104
105 /**
106 * Admin bar menu item for the hidden admin notices
107 *
108 * @link https://developer.wordpress.org/reference/classes/wp_admin_bar/add_menu/
109 * @link https://developer.wordpress.org/reference/classes/wp_admin_bar/add_node/
110 * @since 1.2.0
111 */
112 public function admin_notices_menu( WP_Admin_Bar $wp_admin_bar )
113 {
114 $options = get_option( ASENHA_SLUG_U, array() );
115 $hide_for_nonadmins = ( isset( $options['hide_admin_notices_for_nonadmins'] ) ? $options['hide_admin_notices_for_nonadmins'] : false );
116
117 if ( $hide_for_nonadmins && bwasenha_fs()->can_use_premium_code__premium_only() ) {
118 $minimum_capability = 'read';
119 } else {
120 $minimum_capability = 'manage_options';
121 }
122
123 if ( current_user_can( $minimum_capability ) ) {
124 $wp_admin_bar->add_menu( array(
125 'id' => 'asenha-hide-admin-notices',
126 'parent' => 'top-secondary',
127 'grou' => null,
128 'title' => 'Notices<span class="asenha-admin-notices-counter" style="opacity:0;">0</span>',
129 'meta' => array(
130 'class' => 'asenha-admin-notices-menu',
131 'title' => 'Click to view hidden admin notices',
132 ),
133 ) );
134 }
135 }
136
137 /**
138 * Inline CSS for the admin bar notices menu
139 *
140 * @since 1.2.0
141 */
142 public function admin_notices_menu_inline_css()
143 {
144 $options = get_option( ASENHA_SLUG_U, array() );
145 $hide_for_nonadmins = ( isset( $options['hide_admin_notices_for_nonadmins'] ) ? $options['hide_admin_notices_for_nonadmins'] : false );
146
147 if ( $hide_for_nonadmins && bwasenha_fs()->can_use_premium_code__premium_only() ) {
148 $minimum_capability = 'read';
149 } else {
150 $minimum_capability = 'manage_options';
151 }
152
153
154 if ( current_user_can( $minimum_capability ) ) {
155 wp_add_inline_style( 'admin-bar', '
156
157 #wpadminbar .asenha-admin-notices-counter {
158 box-sizing: border-box;
159 margin: 1px 0 -1px 6px ;
160 padding: 2px 6px 3px 5px;
161 min-width: 18px;
162 height: 18px;
163 border-radius: 50%;
164 background-color: #ca4a1f;
165 color: #fff;
166 font-size: 11px;
167 line-height: 1.6;
168 text-align: center;
169 }
170
171 ' );
172 // Below we pre-emptively hide notices to avoid having them shown briefly before being moved into the notices panel via JS
173 ?>
174 <style type="text/css">
175 /* #wpbody-content .notice:not(.system-notice,.update-message),
176 #wpbody-content .notice-error,
177 #wpbody-content .error,
178 #wpbody-content .notice-info,
179 #wpbody-content .notice-information,
180 #wpbody-content #message,
181 #wpbody-content .notice-warning:not(.update-message),
182 #wpbody-content .notice-success:not(.update-message),
183 #wpbody-content .notice-updated,
184 #wpbody-content .updated:not(.active, .inactive, .plugin-update-tr),
185 #wpbody-content .update-nag, */
186 #wpbody-content > .wrap > .notice:not(.system-notice,.hidden),
187 #wpbody-content > .wrap > .notice-error,
188 #wpbody-content > .wrap > .error:not(.hidden),
189 #wpbody-content > .wrap > .notice-info,
190 #wpbody-content > .wrap > .notice-information,
191 #wpbody-content > .wrap > #message,
192 #wpbody-content > .wrap > .notice-warning:not(.hidden),
193 #wpbody-content > .wrap > .notice-success,
194 #wpbody-content > .wrap > .notice-updated,
195 #wpbody-content > .wrap > .updated,
196 #wpbody-content > .wrap > .update-nag,
197 #wpbody-content > .wrap > div > .notice:not(.system-notice,.hidden),
198 #wpbody-content > .wrap > div > .notice-error,
199 #wpbody-content > .wrap > div > .error:not(.hidden),
200 #wpbody-content > .wrap > div > .notice-info,
201 #wpbody-content > .wrap > div > .notice-information,
202 #wpbody-content > .wrap > div > #message,
203 #wpbody-content > .wrap > div > .notice-warning:not(.hidden),
204 #wpbody-content > .wrap > div > .notice-success,
205 #wpbody-content > .wrap > div > .notice-updated,
206 #wpbody-content > .wrap > div > .updated,
207 #wpbody-content > .wrap > div > .update-nag,
208 #wpbody-content > div > .wrap > .notice:not(.system-notice,.hidden),
209 #wpbody-content > div > .wrap > .notice-error,
210 #wpbody-content > div > .wrap > .error:not(.hidden),
211 #wpbody-content > div > .wrap > .notice-info,
212 #wpbody-content > div > .wrap > .notice-information,
213 #wpbody-content > div > .wrap > #message,
214 #wpbody-content > div > .wrap > .notice-warning:not(.hidden),
215 #wpbody-content > div > .wrap > .notice-success,
216 #wpbody-content > div > .wrap > .notice-updated,
217 #wpbody-content > div > .wrap > .updated,
218 #wpbody-content > div > .wrap > .update-nag,
219 #wpbody-content > .notice,
220 #wpbody-content > .error,
221 #wpbody-content > .updated,
222 #wpbody-content > .update-nag,
223 #wpbody-content > .jp-connection-banner,
224 #wpbody-content > .jitm-banner,
225 #wpbody-content > .jetpack-jitm-message,
226 #wpbody-content > .ngg_admin_notice,
227 #wpbody-content > .imagify-welcome,
228 #wpbody-content #wordfenceAutoUpdateChoice,
229 #wpbody-content #easy-updates-manager-dashnotice {
230 position: absolute !important;
231 visibility: hidden !important;
232 }
233 </style>
234 <?php
235 }
236
237 }
238
239 /**
240 * Disable dashboard widgets
241 *
242 * @since 4.2.0
243 */
244 public function disable_dashboard_widgets()
245 {
246 global $wp_meta_boxes ;
247 // Get list of disabled widgets
248 $options = get_option( ASENHA_SLUG_U, array() );
249 $disabled_dashboard_widgets = $options['disabled_dashboard_widgets'];
250 // Store default widgets in extra options. This will be referenced from settings field.
251 $dashboard_widgets = $this->get_dashboard_widgets();
252 $extra_options = get_option( 'admin_site_enhancements_extra', array() );
253 $extra_options['dashboard_widgets'] = $dashboard_widgets;
254 update_option( 'admin_site_enhancements_extra', $extra_options );
255 // Disable widgets
256 if ( is_array( $disabled_dashboard_widgets ) || is_object( $disabled_dashboard_widgets ) ) {
257 foreach ( $disabled_dashboard_widgets as $disabled_widget_id_context_priority => $is_disabled ) {
258 // e.g. dashboard_activity__normal__core => true/false
259
260 if ( $is_disabled ) {
261 $disabled_widget = explode( '__', $disabled_widget_id_context_priority );
262 $widget_id = $disabled_widget[0];
263 $widget_context = $disabled_widget[1];
264 $widget_priority = $disabled_widget[2];
265 // remove_meta_box( $widget_id, get_current_screen()->base, $widget_context );
266 unset( $wp_meta_boxes['dashboard'][$widget_context][$widget_priority][$widget_id] );
267 }
268
269 }
270 }
271 }
272
273 /**
274 * Get dashboard widgets
275 *
276 * @since 4.2.0
277 */
278 public function get_dashboard_widgets()
279 {
280 global $wp_meta_boxes ;
281 $dashboard_widgets = array();
282
283 if ( !isset( $wp_meta_boxes['dashboard'] ) ) {
284 $extra_options = get_option( 'admin_site_enhancements_extra', array() );
285
286 if ( !array_key_exists( 'dashboard_widgets', $extra_options ) ) {
287 require_once ABSPATH . '/wp-admin/includes/dashboard.php';
288 set_current_screen( 'dashboard' );
289 wp_dashboard_setup();
290 }
291
292 }
293
294 if ( isset( $wp_meta_boxes['dashboard'] ) ) {
295 foreach ( $wp_meta_boxes['dashboard'] as $context => $priorities ) {
296 foreach ( $priorities as $priority => $widgets ) {
297 foreach ( $widgets as $widget_id => $data ) {
298 $widget_title = ( isset( $data['title'] ) ? wp_strip_all_tags( preg_replace( '/ <span.*span>/im', '', $data['title'] ) ) : 'Undetectable' );
299 $dashboard_widgets[$widget_id] = array(
300 'id' => $widget_id,
301 'title' => $widget_title,
302 'context' => $context,
303 'priority' => $priority,
304 );
305 }
306 }
307 }
308 }
309 $dashboard_widgets = wp_list_sort(
310 $dashboard_widgets,
311 'title',
312 'ASC',
313 true
314 );
315 return $dashboard_widgets;
316 }
317
318 /**
319 * Hide admin bar on the frontend for the user roles selected
320 *
321 * @since 1.3.0
322 */
323 public function hide_admin_bar_for_roles_on_frontend()
324 {
325 $options = get_option( ASENHA_SLUG_U );
326 $hide_admin_bar = $options['hide_admin_bar'];
327 $for_roles_frontend = $options['hide_admin_bar_for'];
328 $current_user = wp_get_current_user();
329 $current_user_roles = (array) $current_user->roles;
330 // single dimensional array of role slugs
331 // User has no role, i.e. logged-out
332
333 if ( count( $current_user_roles ) == 0 ) {
334 return false;
335 // hide admin bar
336 }
337
338 // User has role(s). Do further checks.
339
340 if ( isset( $for_roles_frontend ) && count( $for_roles_frontend ) > 0 ) {
341 // Assemble single-dimensional array of roles for which admin bar would be hidden
342 $roles_admin_bar_hidden_frontend = array();
343 foreach ( $for_roles_frontend as $role_slug => $admin_bar_hidden ) {
344 if ( $admin_bar_hidden ) {
345 $roles_admin_bar_hidden_frontend[] = $role_slug;
346 }
347 }
348 // Check if any of the current user roles is one for which admin bar should be hidden
349 foreach ( $current_user_roles as $role ) {
350
351 if ( in_array( $role, $roles_admin_bar_hidden_frontend ) ) {
352 return false;
353 // hide admin bar
354 }
355
356 }
357 }
358
359 return true;
360 // show admin bar
361 }
362
363 /**
364 * Set custom admin menu width
365 *
366 * @since 5.2.0
367 */
368 public function set_custom_menu_width()
369 {
370 $options = get_option( ASENHA_SLUG_U, array() );
371 $custom_width = $options['admin_menu_width'];
372 $wp_version = get_bloginfo( 'version' );
373
374 if ( version_compare( $wp_version, '5', '>' ) ) {
375 require_once ASENHA_PATH . 'includes/admin-menu-width/wp-v5-greater.php';
376 } elseif ( version_compare( $wp_version, '4', '>=' ) ) {
377 require_once ASENHA_PATH . 'includes/admin-menu-width/wp-v4-greater.php';
378 } else {
379 }
380
381 }
382
383 /**
384 * Render custom menu order
385 *
386 * @param $menu_order array an ordered array of menu items
387 * @link https://developer.wordpress.org/reference/hooks/menu_order/
388 * @since 2.0.0
389 */
390 public function render_custom_menu_order( $menu_order )
391 {
392 global $menu ;
393 $options = get_option( ASENHA_SLUG_U );
394 // Get current menu order. We're not using the default $menu_order which uses index.php, edit.php as array values.
395 $current_menu_order = array();
396 foreach ( $menu as $menu_key => $menu_info ) {
397
398 if ( false !== strpos( $menu_info[4], 'wp-menu-separator' ) ) {
399 $menu_item_id = $menu_info[2];
400 } else {
401 $menu_item_id = $menu_info[5];
402 }
403
404 $current_menu_order[] = array( $menu_item_id, $menu_info[2] );
405 }
406 // Get custom menu order
407 $custom_menu_order = $options['custom_menu_order'];
408 // comma separated
409 $custom_menu_order = explode( ",", $custom_menu_order );
410 // array of menu ID, e.g. menu-dashboard
411 // Return menu order for rendering
412 $rendered_menu_order = array();
413 // Render menu based on items saved in custom menu order
414 foreach ( $custom_menu_order as $custom_menu_item_id ) {
415 foreach ( $current_menu_order as $current_menu_item_id => $current_menu_item ) {
416 if ( $custom_menu_item_id == $current_menu_item[0] ) {
417 $rendered_menu_order[] = $current_menu_item[1];
418 }
419 }
420 }
421 // Add items from current menu not already part of custom menu order, e.g. new plugin activated and adds new menu item
422 foreach ( $current_menu_order as $current_menu_item_id => $current_menu_item ) {
423 if ( !in_array( $current_menu_item[0], $custom_menu_order ) ) {
424 $rendered_menu_order[] = $current_menu_item[1];
425 }
426 }
427 return $rendered_menu_order;
428 }
429
430 /**
431 * Apply custom menu item titles
432 *
433 * @since 2.9.0
434 */
435 public function apply_custom_menu_item_titles()
436 {
437 global $menu ;
438 $options = get_option( ASENHA_SLUG_U );
439 // Get custom menu item titles
440 $custom_menu_titles = $options['custom_menu_titles'];
441 $custom_menu_titles = explode( ',', $custom_menu_titles );
442 foreach ( $menu as $menu_key => $menu_info ) {
443
444 if ( false !== strpos( $menu_info[4], 'wp-menu-separator' ) ) {
445 $menu_item_id = $menu_info[2];
446 } else {
447 $menu_item_id = $menu_info[5];
448 }
449
450 // Get defaul/custom menu item title
451 foreach ( $custom_menu_titles as $custom_menu_title ) {
452 // At this point, $custom_menu_title value looks like toplevel_page_snippets__Code Snippets
453 $custom_menu_title = explode( '__', $custom_menu_title );
454
455 if ( $custom_menu_title[0] == $menu_item_id ) {
456 $menu_item_title = $custom_menu_title[1];
457 // e.g. Code Snippets
458 break;
459 // stop foreach loop so $menu_item_title is not overwritten in the next iteration
460 } else {
461 $menu_item_title = $menu_info[0];
462 }
463
464 }
465 $menu[$menu_key][0] = $menu_item_title;
466 }
467 }
468
469 /**
470 * Hide menu items by adding a class to hide them (part of WP Core's common.css)
471 *
472 * @since 2.0.0
473 */
474 public function hide_menu_items()
475 {
476 global $menu ;
477 $common_methods = new Common_Methods();
478 $menu_hidden_by_toggle = $common_methods->get_menu_hidden_by_toggle();
479 // indexed array
480 foreach ( $menu as $menu_key => $menu_info ) {
481
482 if ( false !== strpos( $menu_info[4], 'wp-menu-separator' ) ) {
483 $menu_item_id = $menu_info[2];
484 } else {
485 $menu_item_id = $menu_info[5];
486 }
487
488 // Append 'hidden' class to hide menu item until toggled
489 if ( in_array( $menu_item_id, $menu_hidden_by_toggle ) ) {
490 $menu[$menu_key][4] = $menu_info[4] . ' hidden asenha_hidden_menu';
491 }
492 }
493 }
494
495 /**
496 * Add toggle to show hidden menu items
497 *
498 * @since 2.0.0
499 */
500 public function add_hidden_menu_toggle()
501 {
502 global $current_user ;
503 // Get menu items hidden by toggle
504 $common_methods = new Common_Methods();
505 $menu_hidden_by_toggle = $common_methods->get_menu_hidden_by_toggle();
506 // Get user capabilities the "Show All/Less" toggle should be shown for
507 $user_capabilities_to_show_menu_toggle_for = $common_methods->get_user_capabilities_to_show_menu_toggle_for();
508 // Get current user's capabilities from the user's role(s)
509 $current_user_capabilities = '';
510 $current_user_roles = $current_user->roles;
511 // indexed array of role slugs
512 foreach ( $current_user_roles as $current_user_role ) {
513 $current_user_role_capabilities = get_role( $current_user_role )->capabilities;
514 $current_user_role_capabilities = array_keys( $current_user_role_capabilities );
515 // indexed array
516 $current_user_role_capabilities = implode( ",", $current_user_role_capabilities );
517 $current_user_capabilities .= $current_user_role_capabilities;
518 }
519 $current_user_capabilities = array_unique( explode( ",", $current_user_capabilities ) );
520 // Maybe show "Show All/Less" toggle
521 $show_toggle_menu = false;
522 foreach ( $user_capabilities_to_show_menu_toggle_for as $user_capability_to_show_menu_toggle_for ) {
523
524 if ( in_array( $user_capability_to_show_menu_toggle_for, $current_user_capabilities ) ) {
525 $show_toggle_menu = true;
526 break;
527 }
528
529 }
530
531 if ( !empty($menu_hidden_by_toggle) && $show_toggle_menu ) {
532 add_menu_page(
533 'Show All',
534 'Show All',
535 'read',
536 'asenha_show_hidden_menu',
537 function () {
538 return false;
539 },
540 "dashicons-arrow-down-alt2",
541 300
542 );
543 add_menu_page(
544 'Show Less',
545 'Show Less',
546 'read',
547 'asenha_hide_hidden_menu',
548 function () {
549 return false;
550 },
551 "dashicons-arrow-up-alt2",
552 301
553 );
554 }
555
556 }
557
558 /**
559 * Script to toggle hidden menu itesm
560 *
561 * @since 2.0.0
562 */
563 public function enqueue_toggle_hidden_menu_script()
564 {
565 // Get menu items hidden by toggle
566 $common_methods = new Common_Methods();
567 $menu_hidden_by_toggle = $common_methods->get_menu_hidden_by_toggle();
568 if ( !empty($menu_hidden_by_toggle) ) {
569 // Script to set behaviour and actions of the sortable menu
570 wp_enqueue_script(
571 'asenha-toggle-hidden-menu',
572 ASENHA_URL . 'assets/js/toggle-hidden-menu.js',
573 array(),
574 ASENHA_VERSION,
575 false
576 );
577 }
578 }
579
580 /**
581 * Get and set default columns
582 *
583 * @since 6.0.9
584 */
585 public function get_default_columns( $post_type )
586 {
587 global $taxonomy_slugs ;
588 // indexed array of taxonomy slugs
589 $available_columns = array(
590 'date_published' => 'Published',
591 'postid' => 'ID',
592 'modified' => 'Last Modified',
593 'password_protected' => 'Password Protected',
594 'permalink' => 'Permalink',
595 'slug' => 'Slug',
596 'status' => 'Status',
597 'date' => 'Date',
598 );
599 if ( 'post' == $post_type ) {
600 $available_columns['sticky'] = 'Sticky';
601 }
602
603 if ( post_type_supports( $post_type, 'title' ) ) {
604 $available_columns['title'] = 'Title';
605 // $available_columns['title_raw'] = 'Title Only';
606 }
607
608 if ( post_type_supports( $post_type, 'editor' ) || post_type_supports( $post_type, 'excerpt' ) ) {
609 $available_columns['excerpt'] = 'Excerpt';
610 }
611 if ( post_type_supports( $post_type, 'thumbnail' ) ) {
612 $available_columns['featured_image'] = 'Featured Image';
613 }
614
615 if ( post_type_supports( $post_type, 'author' ) ) {
616 $available_columns['author'] = 'Author';
617 // $available_columns['author_name'] = 'Author';
618 // $available_columns['last_modified_author'] = 'Last Modified Author';
619 }
620
621 if ( post_type_supports( $post_type, 'post-formats' ) ) {
622 $available_columns['post_formats'] = 'Post Format';
623 }
624
625 if ( post_type_supports( $post_type, 'comments' ) ) {
626 $available_columns['comments'] = 'Comments';
627 $available_columns['comment_count'] = 'Comment Count';
628 $available_columns['comment_status'] = 'Allow Comment';
629 }
630
631 if ( post_type_supports( $post_type, 'trackbacks' ) ) {
632 $available_columns['ping_status'] = 'Ping Status';
633 }
634 if ( post_type_supports( $post_type, 'post-formats' ) ) {
635 $available_columns['post_formats'] = 'Post Format';
636 }
637
638 if ( post_type_supports( $post_type, 'page-attributes' ) || is_post_type_hierarchical( $post_type ) ) {
639 $available_columns['post_parent'] = 'Post Parent';
640 $available_columns['menu_order'] = 'Menu Order';
641 }
642
643 // Add taxonomy columns according to the custom taxonomies assigned to each post type
644 $attached_taxonomies = get_object_taxonomies( $post_type );
645
646 if ( !empty($attached_taxonomies) ) {
647 $taxonomy_slugs = array();
648 foreach ( $attached_taxonomies as $taxonomy_slug ) {
649 $taxonomy_object = get_taxonomy( $taxonomy_slug );
650 $taxonomy_label = $taxonomy_object->labels->name;
651
652 if ( 'category' == $taxonomy_slug ) {
653 $taxonomy_slug = 'categories';
654 } elseif ( 'post_tag' == $taxonomy_slug ) {
655 $taxonomy_slug = 'tags';
656 }
657
658 $taxonomy_slugs[] = $taxonomy_slug;
659 $available_columns[$taxonomy_slug] = $taxonomy_label;
660 }
661 }
662
663 // Sort by array value in ascending order, so they are displayed in that order in the 'Default' pane
664 asort( $available_columns );
665 $options = get_option( ASENHA_SLUG_U . '_extra', array() );
666 $options['admin_columns_available'][$post_type] = $available_columns;
667 update_option( ASENHA_SLUG_U . '_extra', $options );
668 return $available_columns;
669 }
670
671 /**
672 * Get ACF field object data
673 *
674 * @since 6.3.0
675 */
676 public function get_acf_field_object(
677 $column_name = '',
678 $post_id = false,
679 $in_collection = false,
680 $parent_field = false,
681 $parent_type = ''
682 )
683 {
684 $field_data = array();
685
686 if ( !$in_collection ) {
687 $field_data = get_field_object( $column_name, $post_id );
688 } else {
689 $parent_field_data = get_field_object( $parent_field, $post_id );
690
691 if ( 'group' == $parent_type || 'repeater' == $parent_type ) {
692 $sub_fields = $parent_field_data['sub_fields'];
693 foreach ( $sub_fields as $sub_field ) {
694 if ( $column_name == $sub_field['name'] ) {
695 $field_data = $sub_field;
696 }
697 }
698 }
699
700
701 if ( 'flexible_content' == $parent_type ) {
702 $layouts = $parent_field_data['layouts'];
703 foreach ( $layouts as $layout ) {
704 $sub_fields = $layout['sub_fields'];
705 foreach ( $sub_fields as $sub_field ) {
706 if ( $column_name == $sub_field['name'] ) {
707 $field_data = $sub_field;
708 }
709 }
710 }
711 }
712
713 }
714
715 return $field_data;
716 }
717
718 /**
719 * Reload list table after performing Quick Edit on post types with custom admin columns
720 * This is modified from wp_ajax_inline_save() by adding a script before wp_die() at the end
721 *
722 * @link https://github.com/WordPress/wordpress-develop/blob/6.3/src/wp-admin/includes/ajax-actions.php#L2049-L2159
723 * @since 6.0.6
724 */
725 public function wp_ajax_inline_save_with_page_reload()
726 {
727 global $mode ;
728 check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
729 if ( !isset( $_POST['post_ID'] ) || !(int) $_POST['post_ID'] ) {
730 wp_die();
731 }
732 $post_id = (int) $_POST['post_ID'];
733
734 if ( 'page' === $_POST['post_type'] ) {
735 if ( !current_user_can( 'edit_page', $post_id ) ) {
736 wp_die( __( 'Sorry, you are not allowed to edit this page.' ) );
737 }
738 } else {
739 if ( !current_user_can( 'edit_post', $post_id ) ) {
740 wp_die( __( 'Sorry, you are not allowed to edit this post.' ) );
741 }
742 }
743
744 $last = wp_check_post_lock( $post_id );
745
746 if ( $last ) {
747 $last_user = get_userdata( $last );
748 $last_user_name = ( $last_user ? $last_user->display_name : __( 'Someone' ) );
749 /* translators: %s: User's display name. */
750 $msg_template = __( 'Saving is disabled: %s is currently editing this post.' );
751 if ( 'page' === $_POST['post_type'] ) {
752 /* translators: %s: User's display name. */
753 $msg_template = __( 'Saving is disabled: %s is currently editing this page.' );
754 }
755 printf( $msg_template, esc_html( $last_user_name ) );
756 wp_die();
757 }
758
759 $data =& $_POST;
760 $post = get_post( $post_id, ARRAY_A );
761 // Since it's coming from the database.
762 $post = wp_slash( $post );
763 $data['content'] = $post['post_content'];
764 $data['excerpt'] = $post['post_excerpt'];
765 // Rename.
766 $data['user_ID'] = get_current_user_id();
767 if ( isset( $data['post_parent'] ) ) {
768 $data['parent_id'] = $data['post_parent'];
769 }
770 // Status.
771
772 if ( isset( $data['keep_private'] ) && 'private' === $data['keep_private'] ) {
773 $data['visibility'] = 'private';
774 $data['post_status'] = 'private';
775 } else {
776 $data['post_status'] = $data['_status'];
777 }
778
779 if ( empty($data['comment_status']) ) {
780 $data['comment_status'] = 'closed';
781 }
782 if ( empty($data['ping_status']) ) {
783 $data['ping_status'] = 'closed';
784 }
785 // Exclude terms from taxonomies that are not supposed to appear in Quick Edit.
786 if ( !empty($data['tax_input']) ) {
787 foreach ( $data['tax_input'] as $taxonomy => $terms ) {
788 $tax_object = get_taxonomy( $taxonomy );
789 /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
790 if ( !apply_filters(
791 'quick_edit_show_taxonomy',
792 $tax_object->show_in_quick_edit,
793 $taxonomy,
794 $post['post_type']
795 ) ) {
796 unset( $data['tax_input'][$taxonomy] );
797 }
798 }
799 }
800 // Hack: wp_unique_post_slug() doesn't work for drafts, so we will fake that our post is published.
801
802 if ( !empty($data['post_name']) && in_array( $post['post_status'], array( 'draft', 'pending' ), true ) ) {
803 $post['post_status'] = 'publish';
804 $data['post_name'] = wp_unique_post_slug(
805 $data['post_name'],
806 $post['ID'],
807 $post['post_status'],
808 $post['post_type'],
809 $post['post_parent']
810 );
811 }
812
813 // Update the post.
814 edit_post();
815 $wp_list_table = _get_list_table( 'WP_Posts_List_Table', array(
816 'screen' => $_POST['screen'],
817 ) );
818 $mode = ( 'excerpt' === $_POST['post_view'] ? 'excerpt' : 'list' );
819 $level = 0;
820
821 if ( is_post_type_hierarchical( $wp_list_table->screen->post_type ) ) {
822 $request_post = array( get_post( $_POST['post_ID'] ) );
823 $parent = $request_post[0]->post_parent;
824 while ( $parent > 0 ) {
825 $parent_post = get_post( $parent );
826 $parent = $parent_post->post_parent;
827 $level++;
828 }
829 }
830
831 $wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ), $level );
832 // INTERCEPT: Add a script to reload the list table page
833 ?>
834 <script type="text/javascript">
835 jQuery('#post-<?php
836 echo $_POST['post_ID'] ;
837 ?>').css('opacity','0.3');
838 document.location.reload(true);
839 </script>
840 <?php
841 // end INTERCEPT
842 wp_die();
843 }
844
845 /**
846 * Hide the Help tab and drawer
847 *
848 * @since 4.5.0
849 */
850 public function hide_help_drawer()
851 {
852
853 if ( is_admin() ) {
854 $screen = get_current_screen();
855 $screen->remove_help_tabs();
856 }
857
858 }
859
860 /**
861 * Current post type. For Content Admin >> Show Custom Taxonomy Filters functionality.
862 */
863 public $post_type ;
864 /**
865 * Show featured images column in list tables for pages and post types that support featured image
866 *
867 * @since 1.0.0
868 */
869 public function show_featured_image_column()
870 {
871 $post_types = get_post_types( array(
872 'public' => true,
873 ), 'names' );
874 foreach ( $post_types as $post_type_key => $post_type_name ) {
875
876 if ( post_type_supports( $post_type_key, 'thumbnail' ) ) {
877 add_filter( "manage_{$post_type_name}_posts_columns", [ $this, 'add_featured_image_column' ], 999 );
878 add_action(
879 "manage_{$post_type_name}_posts_custom_column",
880 [ $this, 'add_featured_image' ],
881 10,
882 2
883 );
884 }
885
886 }
887 }
888
889 /**
890 * Add a column called Featured Image as the first column
891 *
892 * @param mixed $columns
893 * @return void
894 * @since 1.0.0
895 */
896 public function add_featured_image_column( $columns )
897 {
898 $new_columns = array();
899 foreach ( $columns as $key => $value ) {
900 if ( 'title' == $key ) {
901 // We add featured image column before the 'title' column
902 $new_columns['asenha-featured-image'] = 'Featured Image';
903 }
904 if ( 'thumb' == $key ) {
905 // For WooCommerce products, we add featured image column before it's native thumbnail column
906 $new_columns['asenha-featured-image'] = 'Product Image';
907 }
908 $new_columns[$key] = $value;
909 }
910 // Replace WooCommerce thumbnail column with ASE featured image column
911 if ( array_key_exists( 'thumb', $new_columns ) ) {
912 unset( $new_columns['thumb'] );
913 }
914 return $new_columns;
915 }
916
917 /**
918 * Echo featured image's in thumbnail size to a column
919 *
920 * @param mixed $column_name
921 * @param mixed $id
922 * @since 1.0.0
923 */
924 public function add_featured_image( $column_name, $id )
925 {
926 if ( 'asenha-featured-image' === $column_name ) {
927
928 if ( has_post_thumbnail( $id ) ) {
929 $size = 'thumbnail';
930 echo get_the_post_thumbnail( $id, $size, '' ) ;
931 } else {
932 echo '<img src="' . esc_url( plugins_url( 'assets/img/default_featured_image.jpg', __DIR__ ) ) . '" />' ;
933 }
934
935 }
936 }
937
938 /**
939 * Show excerpt column in list tables for pages and post types that support excerpt.
940 *
941 * @since 1.0.0
942 */
943 public function show_excerpt_column()
944 {
945 $post_types = get_post_types( array(
946 'public' => true,
947 ), 'names' );
948 foreach ( $post_types as $post_type_key => $post_type_name ) {
949
950 if ( post_type_supports( $post_type_key, 'excerpt' ) ) {
951 add_filter( "manage_{$post_type_name}_posts_columns", [ $this, 'add_excerpt_column' ] );
952 add_action(
953 "manage_{$post_type_name}_posts_custom_column",
954 [ $this, 'add_excerpt' ],
955 10,
956 2
957 );
958 }
959
960 }
961 }
962
963 /**
964 * Add a column called Featured Image as the first column
965 *
966 * @param mixed $columns
967 * @return void
968 * @since 1.0.0
969 */
970 public function add_excerpt_column( $columns )
971 {
972 $new_columns = array();
973 foreach ( $columns as $key => $value ) {
974 $new_columns[$key] = $value;
975 if ( $key == 'title' ) {
976 $new_columns['asenha-excerpt'] = 'Excerpt';
977 }
978 }
979 return $new_columns;
980 }
981
982 /**
983 * Echo featured image's in thumbnail size to a column
984 *
985 * @param mixed $column_name
986 * @param mixed $id
987 * @since 1.0.0
988 */
989 public function add_excerpt( $column_name, $id )
990 {
991
992 if ( 'asenha-excerpt' === $column_name ) {
993 $excerpt = get_the_excerpt( $id );
994 // about 310 characters
995 $excerpt = substr( $excerpt, 0, 160 );
996 // truncate to 160 characters
997 $short_excerpt = substr( $excerpt, 0, strrpos( $excerpt, ' ' ) );
998 echo wp_kses_post( $short_excerpt ) ;
999 }
1000
1001 }
1002
1003 /**
1004 * Add ID column list table of pages, posts, custom post types, media, taxonomies, custom taxonomies, users amd comments
1005 *
1006 * @since 1.0.0
1007 */
1008 public function show_id_column()
1009 {
1010 // For pages and hierarchical post types list table
1011 add_filter( 'manage_pages_columns', [ $this, 'add_id_column' ] );
1012 add_action(
1013 'manage_pages_custom_column',
1014 [ $this, 'add_id_echo_value' ],
1015 10,
1016 2
1017 );
1018 // For posts and non-hierarchical custom posts list table
1019 add_filter( 'manage_posts_columns', [ $this, 'add_id_column' ] );
1020 add_action(
1021 'manage_posts_custom_column',
1022 [ $this, 'add_id_echo_value' ],
1023 10,
1024 2
1025 );
1026 // For media list table
1027 add_filter( 'manage_media_columns', [ $this, 'add_id_column' ] );
1028 add_action(
1029 'manage_media_custom_column',
1030 [ $this, 'add_id_echo_value' ],
1031 10,
1032 2
1033 );
1034 // For list table of all taxonomies
1035 $taxonomies = get_taxonomies( [
1036 'public' => true,
1037 ], 'names' );
1038 foreach ( $taxonomies as $taxonomy ) {
1039 add_filter( 'manage_edit-' . $taxonomy . '_columns', [ $this, 'add_id_column' ] );
1040 add_action(
1041 'manage_' . $taxonomy . '_custom_column',
1042 [ $this, 'add_id_return_value' ],
1043 10,
1044 3
1045 );
1046 }
1047 // For users list table
1048 add_filter( 'manage_users_columns', [ $this, 'add_id_column' ] );
1049 add_action(
1050 'manage_users_custom_column',
1051 [ $this, 'add_id_return_value' ],
1052 10,
1053 3
1054 );
1055 // For comments list table
1056 add_filter( 'manage_edit-comments_columns', [ $this, 'add_id_column' ] );
1057 add_action(
1058 'manage_comments_custom_column',
1059 [ $this, 'add_id_echo_value' ],
1060 10,
1061 3
1062 );
1063 }
1064
1065 /**
1066 * Add a column called ID
1067 *
1068 * @param mixed $columns
1069 * @return void
1070 * @since 1.0.0
1071 */
1072 public function add_id_column( $columns )
1073 {
1074 $columns['asenha-id'] = 'ID';
1075 return $columns;
1076 }
1077
1078 /**
1079 * Echo post ID value to a column
1080 *
1081 * @param mixed $column_name
1082 * @param mixed $id
1083 * @since 1.0.0
1084 */
1085 public function add_id_echo_value( $column_name, $id )
1086 {
1087 if ( 'asenha-id' === $column_name ) {
1088 echo esc_html( $id ) ;
1089 }
1090 }
1091
1092 /**
1093 * Return post ID value to a column
1094 *
1095 * @param mixed $value
1096 * @param mixed $column_name
1097 * @param mixed $id
1098 * @since 1.0.0
1099 */
1100 public function add_id_return_value( $value, $column_name, $id )
1101 {
1102 if ( 'asenha-id' === $column_name ) {
1103 $value = $id;
1104 }
1105 return $value;
1106 }
1107
1108 /**
1109 * Add ID in the action row of list tables for pages, posts, custom post types, media, taxonomies, custom taxonomies, users amd comments
1110 *
1111 * @since 4.7.4
1112 */
1113 public function show_id_in_action_row()
1114 {
1115 add_filter(
1116 'page_row_actions',
1117 array( $this, 'add_id_in_action_row' ),
1118 10,
1119 2
1120 );
1121 add_filter(
1122 'post_row_actions',
1123 array( $this, 'add_id_in_action_row' ),
1124 10,
1125 2
1126 );
1127 add_filter(
1128 'cat_row_actions',
1129 array( $this, 'add_id_in_action_row' ),
1130 10,
1131 2
1132 );
1133 add_filter(
1134 'tag_row_actions',
1135 array( $this, 'add_id_in_action_row' ),
1136 10,
1137 2
1138 );
1139 add_filter(
1140 'media_row_actions',
1141 array( $this, 'add_id_in_action_row' ),
1142 10,
1143 2
1144 );
1145 add_filter(
1146 'comment_row_actions',
1147 array( $this, 'add_id_in_action_row' ),
1148 10,
1149 2
1150 );
1151 add_filter(
1152 'user_row_actions',
1153 array( $this, 'add_id_in_action_row' ),
1154 10,
1155 2
1156 );
1157 }
1158
1159 /**
1160 * Output the ID in the action row
1161 *
1162 * @since 4.7.4
1163 */
1164 public function add_id_in_action_row( $actions, $object )
1165 {
1166
1167 if ( current_user_can( 'edit_posts' ) ) {
1168 // For pages, posts, custom post types, media/attachments, users
1169 if ( property_exists( $object, 'ID' ) ) {
1170 $id = $object->ID;
1171 }
1172 // For taxonomies
1173 if ( property_exists( $object, 'term_id' ) ) {
1174 $id = $object->term_id;
1175 }
1176 // For comments
1177 if ( property_exists( $object, 'comment_ID' ) ) {
1178 $id = $object->comment_ID;
1179 }
1180 $actions['asenha-list-table-item-id'] = '<span class="asenha-list-table-item-id">ID: ' . $id . '</span>';
1181 }
1182
1183 return $actions;
1184 }
1185
1186 /**
1187 * Hide comments column in list tables for pages, post types that support comments, and alse media/attachments.
1188 *
1189 * @since 1.0.0
1190 */
1191 public function hide_comments_column()
1192 {
1193 $post_types = get_post_types( array(
1194 'public' => true,
1195 ), 'names' );
1196 foreach ( $post_types as $post_type_key => $post_type_name ) {
1197 if ( post_type_supports( $post_type_key, 'comments' ) ) {
1198
1199 if ( 'attachment' != $post_type_name ) {
1200 // For list tables of pages, posts and other post types
1201 add_filter( "manage_{$post_type_name}_posts_columns", [ $this, 'remove_comment_column' ] );
1202 } else {
1203 // For list table of media/attachment
1204 add_filter( 'manage_media_columns', [ $this, 'remove_comment_column' ] );
1205 }
1206
1207 }
1208 }
1209 }
1210
1211 /**
1212 * Add a column called ID
1213 *
1214 * @param mixed $columns
1215 * @return void
1216 * @since 1.0.0
1217 */
1218 public function remove_comment_column( $columns )
1219 {
1220 unset( $columns['comments'] );
1221 return $columns;
1222 }
1223
1224 /**
1225 * Hide tags column in list tables for posts.
1226 *
1227 * @since 1.0.0
1228 */
1229 public function hide_post_tags_column()
1230 {
1231 $post_types = get_post_types( array(
1232 'public' => true,
1233 ), 'names' );
1234 foreach ( $post_types as $post_type_key => $post_type_name ) {
1235 if ( $post_type_name == 'post' ) {
1236 add_filter( "manage_posts_columns", [ $this, 'remove_post_tags_column' ] );
1237 }
1238 }
1239 }
1240
1241 /**
1242 * Add a column called ID
1243 *
1244 * @param mixed $columns
1245 * @return void
1246 * @since 1.0.0
1247 */
1248 public function remove_post_tags_column( $columns )
1249 {
1250 unset( $columns['tags'] );
1251 return $columns;
1252 }
1253
1254 /**
1255 * Show custom (hierarchical) taxonomy filter(s) for all post types.
1256 *
1257 * @since 1.0.0
1258 */
1259 public function show_custom_taxonomy_filters( $post_type )
1260 {
1261 $post_taxonomies = get_object_taxonomies( $post_type, 'objects' );
1262 // Only show custom taxonomy filters for post types other than 'post'
1263 if ( 'post' != $post_type && 'attachment' != $post_type && 'asenha_code_snippet' != $post_type ) {
1264 array_walk( $post_taxonomies, [ $this, 'output_taxonomy_filter' ] );
1265 }
1266 }
1267
1268 /**
1269 * Output filter on the post type's list table for a taxonomy
1270 *
1271 * @since 1.0.0
1272 */
1273 public function output_taxonomy_filter( $post_taxonomy )
1274 {
1275 // Only show taxonomy filter when the taxonomy is hierarchical
1276 if ( true === $post_taxonomy->hierarchical ) {
1277 wp_dropdown_categories( array(
1278 'show_option_all' => sprintf( 'All %s', $post_taxonomy->label ),
1279 'orderby' => 'name',
1280 'order' => 'ASC',
1281 'hide_empty' => false,
1282 'hide_if_empty' => true,
1283 'selected' => sanitize_text_field( ( isset( $_GET[$post_taxonomy->query_var] ) && !empty($_GET[$post_taxonomy->query_var]) ? $_GET[$post_taxonomy->query_var] : '' ) ),
1284 'hierarchical' => true,
1285 'name' => $post_taxonomy->query_var,
1286 'taxonomy' => $post_taxonomy->name,
1287 'value_field' => 'slug',
1288 ) );
1289 }
1290 }
1291
1292 }