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?
- Set cookie for visitor
- how to add a div inside wp_page_menu
- How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?
- Assign Custom classes to every Excerpt
- Why in this WordPress theme I can’t see the Main Menu?
- Make next post button link to random post
- Show login greeting above sub-menu links?
- Why can’t I add a custom image in my navigation?
- pass html code to worpdress
- Remove submenu item from list
- pagination broken – clicking next displays “page not found”
- conditional: if is page, and all subpages
- wp nav menu: show submenu below li item
- How to tell if a user has gone in and created a menu
- How do I custom code the start page?
- Display movies that apear this day next
- Kohana Frontend, WordPress Backend
- Dynamic Menu drops pages?
- Class for Selected Menu using wp_nav_menu
- is_user_logged_in returning nothing on custom page
- Customize field names in backend profile edit page through function.php [duplicate]
- Editor capabilities – admin_init
- Remove the Tag from wp_nav_menu
- Menu not styling. New menus functionality giving me a headache
- Styling an “active” link outside of WordPress default menu
- How to create Loop code for Menu using WordPress?
- how to add datas in taxonomy to post with wp_insert_post
- Hard-coding a shortcode as the last menu item in primary navigation?
- Dynamic menu with custom post types
- Site DOES NOT LOAD after 3.1 update
- WP insert post Redirect after function has executed
- Create condition for Author bio Social Links
- Add class to ul and li in wp_na
- Change permalink structure specific category
- Array data not saving to specified sections. How to make seting independantly?
- WP_REST_Response – How to return Gzip answer and add Content-encoding header?
- Customizer control save then return to default
- how to changes mobile menu toggle breakpoint in WordPress
- How to display already created menus via php?
- WP-Bakery – Add custom colors to buttons with template colors
- I need to display posts in subcategory beside posts in main category
- How can I add diffrent editable text fields?
- How can I check that the acf field value is not a duplicate when adding a post?
- Providin exception to WordPress wp_nav_menu Custom CSS Classes
- Removing “There is no account with that username or email address.” error message in “/wp-login.php?action=lostpassword”
- Integrate otp in my custom singup form
- Woocommerce template file outputting tags
- Hide A Class and Add Custom HTML Code Using WordPress
- Trying to update Woocommerce meta values
- How to make only the valid active page of a multilevel menu active with – “.nav li.current-menu-item a”?
- How do I know if the user is a customer?
- Replace jQuery with PHP or CSS for Customized WordPress wp_nav_menu
- How to block specific user id in custom login form?
- dynamic php menu with hidden sub-categories only showing when the category name is clicked
- update_user_meta as multiple value but with same meta key
- I want to fusion the product columns in email table order
- retrieve “Link Color” value
- How to set Nav as a default menu in wordpress
- Inserting a class on before_widget if checkbox is checked
- If Statement is Ignored?
- Add a new view on the Woocommerce account page
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- Delete post meta by serialized meta value
- How do I add a predefined class to a custom html element?
- How to put 2 php codes in functions.php without site crashing
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- How to identify which php file a plugin is using on page load?
- Adding new divs with custom classes to products on WooCommerce shop page [closed]
- Menu not updating for logged in users after redirect
- Dynamic “home” image and URL based on current folder