Per comments, it’s called with call_user_func_array
, so the 1st 2 elements get assigned to the declared arguments $elements
and $max_depth
, leaving the third element ($r
which is the original $args
) to be assigned via array_slice to $args
. Eg
function wpse172812( $elements, $max_depth ) {
$args = array_slice(func_get_args(), 2);
error_log("elements=$elements, max_depth=$max_depth, args=" . print_r( $args, true ));
// elements=arg1, max_depth=arg2,
// args=Array ( [0] => Array ( [menu] => my_id [menu_class] => my_class ) )
}
$args = array( 'arg1', 'arg2', array( 'menu' => 'my_id', 'menu_class' => 'my_class' ) );
call_user_func_array( 'wpse172812', $args );
Related Posts:
- Trouble creating conditional PHP for nav menu items with children for custom Walker
- Mega Menu Walker
- start_lvl Ignored in Custom walker_nav_menu
- How to Use the Function is_user_logged_in To Display Different Menus?
- How to create different menu’s for not logged in visitors and for logged in members?
- Remove all nav menu classes ( but keep useful ones… )
- Run a filter when a walker runs
- Can’t extend some core classes
- create a select input with menus created on a custom options page
- WP Walker using custom css classes
- Automatically adding new post categories to menu
- Custom Walker_Nav_Menu issue with variables on PHP 7.3
- Trying to store submenu items to render out after main menu
- Detecting classes, adding widgets, and adding divs in with a Nav Walker
- New walker for walker_nav_menu to change inside container data
- Add data-id attribute to child page links
- Add login hyperlink to secondary navigation menu
- How to display different submenus?
- Extend Menu Walker Output
- Nav Walker that shows only children and siblings of top level parent menu item
- Create Columns with Custom Walker and CSS Classes
- Adding an Anchor Link to a wordpress menu using WPBakery Page Builder
- Adding markup to sub menu based on class
- Featured image in menu wordpres
- Difference between “Walker_Nav_menu” and “walker”
- Add parent menu item in sub-menu in custom nav_walker
- Add the “.current-menu-item” class to tag?
- How to get the count for each taxonomy term
- Custom Links in Walker Class
- I am extending Walker_Nav_Menu: How can I get the number of children elements of the current item?
- Function to return true if current page has child pages
- Displaying Logged-In User Name in WordPress Menu
- Get author full name
- Integrating WordPress to my website, while keeping my own authentication system
- Display posts by month
- is there a simple way to list every templates / php files used to generate a specific page?
- How To Customize Position of »add to cart« of WooCommerce on Product Page [closed]
- removing tags from wp_list_pages() using PHP
- Authenticating to WordPress, using my own authentication two-factor system
- WordPress menu deletes when trying to add a hook
- Overriding a theme redux file in child theme
- there’s a way to include a minimal WP for check only the current user, its roles (caps?) and then release/free it?
- Second Navigation inside header
- How to display custom field on homepage
- How to display something in a div when the user clicks on a text in another div – no page refresh [closed]
- Creating bulk posts with Youtube videos
- How to display conditional-content if wp_nav_menu( $args ) retruns something
- Setting custom canonical urls
- Only show search results with if current date is between two dates?
- database interactions using OOP
- Menu — How to add “current-menu-grand-ancestor” css class
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- WordPress blog post url on category page
- Extending the WP_Widget_Text class
- Menu Limitations
- Trying to build simple deposit code that hooks into woocommerce
- user_profile_update_errors hook not executing
- Saving and Restoring a Canvas on A Individual User Basis
- Extend plugin Class through functions.php
- Output custom field value to post string
- Need help enqueueing webfonts
- Custom Menus: dynamic highlighting problem with custom home link
- Redirect to another page using contact form 7? [closed]
- Custom Background by Page IDs
- Underscore – Self hosted fonts
- How to style one item from main navigation?
- Echo title attribute php
- str_replace with the_content is not working
- Menu Custom Data Attributes
- How to modify mobile nav menu text in theme
- How can I use custom menus with a Bootstrap WordPress theme?
- Nav menu from plugin to theme
- Set cookie for visitor
- Why in this WordPress theme I can’t see the Main Menu?
- wp nav menu: show submenu below li item
- Display movies that apear this day next
- Styling an “active” link outside of WordPress default menu
- Array data not saving to specified sections. How to make seting independantly?
- Integrate otp in my custom singup form
- How do I know if the user is a customer?
- How to block specific user id in custom login form?
- I want to fusion the product columns in email table order
- Adding new divs with custom classes to products on WooCommerce shop page [closed]
- Dynamic “home” image and URL based on current folder
- Get Child of Child Pages in custom Menu
- How to disable sub menu items from being created?
- Add custom attribute to product’s HTML to woocommerce cart page
- Autoloading Classes in Plugins
- Display specific main Sub Nav on Woocommerce product pages
- PHP drop down menu for my get_category child of
- Editing existing pre-created menus in PHP
- Active class not working on custom menu link using add_menu_page
- How can I show only if custom field has content [closed]
- How To Customize Position of »add to cart« of WooCommerce on Product Page [closed]
- How does one programmatically manage posts from a external php script?
- Open WordPress Page from selected option dropdown
- How to remove the intro animation which appears during the load up of some WordPress themes? [closed]
- Remove Unused Menu Locations
- Add multiple HTML attributes to an Elementor button
- Custom nav with bootstrap dropdown