Skip to content

Commit

Permalink
[menu] [menu-url] Fixed an issue with the menu URL generation logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
fajardoleo committed Aug 11, 2024
1 parent 8285a8a commit 25e59fd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
22 changes: 18 additions & 4 deletions includes/managers/class-fs-admin-menu-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,15 +699,29 @@ function main_menu_url() {
$menu = $this->find_main_submenu();
}

$parent_slug = isset( $menu['parent_slug'] ) ?
$menu['parent_slug'] :
'admin.php';
$menu_slug = $menu['menu'][2];
$parent_slug = 'admin.php';

/**
* This line and the `if` block below it is based on the `menu_page_url()` function of WordPress.
*
* @author Leo Fajardo (@leorw)
* @since 2.7.4
*/
global $_parent_pages;

if ( ! empty( $_parent_pages[ $menu_slug ] ) ) {
$_parent_slug = $_parent_pages[ $menu_slug ];
$parent_slug = isset( $_parent_pages[ $_parent_slug ] ) ?
$parent_slug :
$menu['parent_slug'];
}

return admin_url(
$parent_slug .
( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
'page=' .
$menu['menu'][2]
$menu_slug
);
}

Expand Down
2 changes: 1 addition & 1 deletion start.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @var string
*/
$this_sdk_version = '2.7.4.2';
$this_sdk_version = '2.7.4.3';

#region SDK Selection Logic --------------------------------------------------------------------

Expand Down

0 comments on commit 25e59fd

Please sign in to comment.