From f9627eae2882334c9f9591c903d4e40b3b052c2b Mon Sep 17 00:00:00 2001 From: Tetrakern <26898880+Tetrakern@users.noreply.github.com> Date: Thu, 17 Oct 2024 22:15:24 +0200 Subject: [PATCH] Update menu Transient check --- functions.php | 4 ++-- stubs.php | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/functions.php b/functions.php index 485fb4d..baac19f 100644 --- a/functions.php +++ b/functions.php @@ -516,7 +516,7 @@ if ( $mobile_nav_style === 'collapse' ) { if ( has_nav_menu( 'nav_menu' ) ) { $menu = null; - if ( FICTIONEER_ENABLE_MENU_TRANSIENTS ) { + if ( fictioneer_enable_menu_transients( 'nav_menu' ) ) { $menu = get_transient( 'fictioneer_fcnmm_nav_menu_html' ); } @@ -536,7 +536,7 @@ if ( $mobile_nav_style === 'collapse' ) { $menu = str_replace( ['current_page_item', 'current-menu-item', 'aria-current="page"'], '', $menu ); } - if ( FICTIONEER_ENABLE_MENU_TRANSIENTS ) { + if ( fictioneer_enable_menu_transients( 'nav_menu' ) ) { set_transient( 'fictioneer_fcnmm_nav_menu_html', $menu ); } } diff --git a/stubs.php b/stubs.php index 2a41d40..0190ab0 100644 --- a/stubs.php +++ b/stubs.php @@ -152,3 +152,18 @@ function fictioneer_sanitize_url( $url, $match = null, $preg_match = null ) {} */ function fictioneer_render_icon_menu( $args ) {} + +/** + * Whether to enable Transients for menus + * + * @since 5.25.0 + * + * @param string $location Location identifier of the menu. Possible locations are + * 'nav_menu', 'mobile_nav_menu', and 'footer_menu'. + * + * @return boolean Either true or false. + */ + +function fictioneer_enable_menu_transients( $location ) { + return true; +}