← All changes
|
libraries/freemius/includes/managers/class-fs-admin-menu-manager.php
+21
-1
2.2
→
3.4
View file →
| @@ -698,17 +698,37 @@ | ||
| 698 | 698 | } else { |
| 699 | 699 | $menu = $this->find_main_submenu(); |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | + $menu_slug = $menu['menu'][2]; | |
| 702 | 703 | $parent_slug = isset( $menu['parent_slug'] ) ? |
| 703 | 704 | $menu['parent_slug'] : |
| 704 | 705 | 'admin.php'; |
| 705 | 706 | |
| 707 | + if ( fs_apply_filter( $this->_module_unique_affix, 'enable_cpt_advanced_menu_logic', false ) ) { | |
| 708 | + $parent_slug = 'admin.php'; | |
| 709 | + | |
| 710 | + /** | |
| 711 | + * This line and the `if` block below it are based on the `menu_page_url()` function of WordPress. | |
| 712 | + * | |
| 713 | + * @author Leo Fajardo (@leorw) | |
| 714 | + * @since 2.10.2 | |
| 715 | + */ | |
| 716 | + global $_parent_pages; | |
| 717 | + | |
| 718 | + if ( ! empty( $_parent_pages[ $menu_slug ] ) ) { | |
| 719 | + $_parent_slug = $_parent_pages[ $menu_slug ]; | |
| 720 | + $parent_slug = isset( $_parent_pages[ $_parent_slug ] ) ? | |
| 721 | + $parent_slug : | |
| 722 | + $menu['parent_slug']; | |
| 723 | + } | |
| 724 | + } | |
| 725 | + | |
| 706 | 726 | return admin_url( |
| 707 | 727 | $parent_slug . |
| 708 | 728 | ( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) . |
| 709 | 729 | 'page=' . |
| 710 | - $menu['menu'][2] | |
| 730 | + $menu_slug | |
| 711 | 731 | ); |
| 712 | 732 | } |
| 713 | 733 | |
| 714 | 734 | /** |