wp_nav_locations_listed_per_menu
Filter HookDescription
Filters the number of locations listed per menu in the drop-down select.Hook Information
| File Location |
wp-admin/nav-menus.php
View on GitHub
|
| Hook Type | Filter |
| Line Number | 1006 |
Hook Parameters
| Type | Name | Description |
|---|---|---|
int
|
$locations
|
Number of menu locations to list. Default 3. |
Usage Examples
Basic Usage
<?php
// Hook into wp_nav_locations_listed_per_menu
add_filter('wp_nav_locations_listed_per_menu', 'my_custom_filter', 10, 1);
function my_custom_filter($locations) {
// Your custom filtering logic here
return $locations;
}
Source Code Context
wp-admin/nav-menus.php:1006
- How this hook is used in WordPress core
<?php
1001 *
1002 * @since 3.6.0
1003 *
1004 * @param int $locations Number of menu locations to list. Default 3.
1005 */
1006 $locations_listed_per_menu = absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) );
1007
1008 $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, $locations_listed_per_menu );
1009
1010 // Adds ellipses following the number of locations defined in $assigned_locations.
1011 if ( ! empty( $assigned_locations ) ) {
PHP Documentation
<?php
/**
* Filters the number of locations listed per menu in the drop-down select.
*
* @since 3.6.0
*
* @param int $locations Number of menu locations to list. Default 3.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-admin/nav-menus.php
Related Hooks
Related hooks will be displayed here in future updates.