Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[menu] [menu-url] Fixed an issue with the menu URL generation logic. #735

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions includes/managers/class-fs-admin-menu-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,16 +699,30 @@ function main_menu_url() {
$menu = $this->find_main_submenu();
}

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

return admin_url(
$parent_slug .
( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
'page=' .
$menu['menu'][2]
);
$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_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
Loading