AnsPress_Admin::fix_active_admin_menu( string $parent_file )
Description #
Fix active menu css class in wp-admin.
Parameters #
- $parent_filestring (Required) Parent file.
Source #
File: admin/anspress-admin.php
public static function fix_active_admin_menu( $parent_file ) { global $submenu_file, $current_screen; // Set correct active/current menu and submenu in the WordPress Admin menu for the "example_cpt" Add-New/Edit/List. if ( in_array( $current_screen->post_type, array( 'question', 'answer' ), true ) ) { $submenu_file = 'edit.php?post_type=' . $current_screen->post_type; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited if ( 'add' === $current_screen->action ) { $submenu_file = 'post-new.php?post_type=' . $current_screen->post_type; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited } $parent_file = 'anspress'; } return $parent_file; }
Expand full source code Collapse full source code View on GitHub: admin/anspress-admin.php:231
Add your comment