menus – WordPress warning: “private_to_published” Deprecated when creating nav with wp_update_nav_menu_item()

Question

For reasons specific to how my local development environment generates WordPress menu items, I am trying to programmatically create a menu using wp_create_nav_menu() and wp_update_nav_menu_item().

My code is as follows:

function register_dynamic_menu(){
    $menu_name="menuName";
    $menu_id = wp_create_nav_menu($menu_name);

    wp_update_nav_menu_item($menu_id, 0, array(
        'menu-item-title' =>  __('Logout'),
        'menu-item-classes' => 'logout',
        'menu-item-url' => wp_logout_url(),
        'menu-item-type' => 'custom',
        'menu-item-status' => 'publish')
    );
}
add_action( 'init', 'register_dynamic_utility_addition' );

I am receiving the following Warning:

Deprecated: private_to_published is deprecated since version 2.3.0! Use private_to_publish instead. in /var/www/html/web/wp/wp-includes/functions.php on line 5152

Can anyone provide insight into why this might be triggering the Depreciation warning?

0
fuxia 4 months 2021-04-02T21:17:59-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse