Skip to content

Commit cb66b97

Browse files
Merge pull request #735 from Freemius/feature/menu-url-fix
[menu] [menu-url] Fixed an issue with the menu URL generation logic.
2 parents 517391b + fecb374 commit cb66b97

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

includes/managers/class-fs-admin-menu-manager.php

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -699,16 +699,30 @@ function main_menu_url() {
699699
$menu = $this->find_main_submenu();
700700
}
701701

702-
$parent_slug = isset( $menu['parent_slug'] ) ?
703-
$menu['parent_slug'] :
704-
'admin.php';
705-
706-
return admin_url(
707-
$parent_slug .
708-
( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
709-
'page=' .
710-
$menu['menu'][2]
711-
);
702+
$menu_slug = $menu['menu'][2];
703+
$parent_slug = 'admin.php';
704+
705+
/**
706+
* This line and the `if` block below it is based on the `menu_page_url()` function of WordPress.
707+
*
708+
* @author Leo Fajardo (@leorw)
709+
* @since 2.7.4
710+
*/
711+
global $_parent_pages;
712+
713+
if ( ! empty( $_parent_pages[ $menu_slug ] ) ) {
714+
$_parent_slug = $_parent_pages[ $menu_slug ];
715+
$parent_slug = isset( $_parent_pages[ $_parent_slug ] ) ?
716+
$parent_slug :
717+
$menu['parent_slug'];
718+
}
719+
720+
return admin_url(
721+
$parent_slug .
722+
( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
723+
'page=' .
724+
$menu_slug
725+
);
712726
}
713727

714728
/**

start.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* @var string
1717
*/
18-
$this_sdk_version = '2.10.0';
18+
$this_sdk_version = '2.10.0.1';
1919

2020
#region SDK Selection Logic --------------------------------------------------------------------
2121

0 commit comments

Comments
 (0)