Skip to content

Commit

Permalink
[menu] Added a new filter for enabling the advanced CPT-related menu …
Browse files Browse the repository at this point in the history
…logic. (#779)
  • Loading branch information
fajardoleo authored Jan 13, 2025
1 parent 8be2505 commit 30965dd
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions includes/managers/class-fs-admin-menu-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -700,21 +700,27 @@ function main_menu_url() {
}

$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'];
$parent_slug = isset( $menu['parent_slug'] ) ?
$menu['parent_slug'] :
'admin.php';

if ( fs_apply_filter( $this->_module_unique_affix, 'enable_cpt_advanced_menu_logic', false ) ) {
$parent_slug = 'admin.php';

/**
* This line and the `if` block below it are based on the `menu_page_url()` function of WordPress.
*
* @author Leo Fajardo (@leorw)
* @since 2.10.2
*/
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(
Expand Down

0 comments on commit 30965dd

Please sign in to comment.