LLMS_Nav_Menus::filter_nav_items( array $items )
Filters Nav Menu Items to convert #llms- urls into actual URLs.
Description Description
Also hides URLs that should only be available to logged in users.
Parameters Parameters
- $items
-
(array) (Required) Nav menu items.
Return Return
(array)
Source Source
File: includes/class.llms.nav.menus.php
} /** * Filters Nav Menu Items to convert #llms- urls into actual URLs. * * Also hides URLs that should only be available to logged-in users. * * @since 3.14.7 * @since 3.37.12 Use `in_array` with strict types comparison. * @since 7.2.0 Remove passing item data by reference and improve URL checks. * * @param array $items Nav menu items. * @return array */ public function filter_nav_items( $items ) { $urls = array( '#llms-signout', '#llms-signin', ); foreach ( $items as $i => $data ) { $is_object = is_object( $data ) && property_exists( $data, 'url' ); $url = $is_object ? $data->url : $data['url'] ?? ''; if ( ! in_array( $url, $urls, true ) ) { continue; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.37.12 | Use in_array with strict types comparison. |
3.14.7 | Introduced. |