wp_nav_menu_post_type_meta_boxes

The timeline below displays how wordpress function wp_nav_menu_post_type_meta_boxes has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.5

/**
 * Creates meta boxes for any post type menu item..
 *
 * @since 3.0.0
 */
function wp_nav_menu_post_type_meta_boxes()
{
    $post_types = get_post_types(array('show_in_nav_menus' => true), 'object');
    if (!$post_types) {
        return;
    }
    foreach ($post_types as $post_type) {
        /**
         * Filters whether a menu items meta box will be added for the current
         * object type.
         *
         * If a falsey value is returned instead of an object, the menu items
         * meta box for the current meta box object will not be added.
         *
         * @since 3.0.0
         *
         * @param WP_Post_Type|false $post_type The current object to add a menu items
         *                                      meta box for.
         */
        $post_type = apply_filters('nav_menu_meta_box_object', $post_type);
        if ($post_type) {
            $id = $post_type->name;
            // Give pages a higher priority.
            $priority = ('page' === $post_type->name) ? 'core' : 'default';
            add_meta_box("add-post-type-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type);
        }
    }
}

WordPress Version: 5.4

/**
 * Creates meta boxes for any post type menu item..
 *
 * @since 3.0.0
 */
function wp_nav_menu_post_type_meta_boxes()
{
    $post_types = get_post_types(array('show_in_nav_menus' => true), 'object');
    if (!$post_types) {
        return;
    }
    foreach ($post_types as $post_type) {
        /**
         * Filters whether a menu items meta box will be added for the current
         * object type.
         *
         * If a falsey value is returned instead of an object, the menu items
         * meta box for the current meta box object will not be added.
         *
         * @since 3.0.0
         *
         * @param WP_Post_Type|false $post_type The current object to add a menu items
         *                                      meta box for.
         */
        $post_type = apply_filters('nav_menu_meta_box_object', $post_type);
        if ($post_type) {
            $id = $post_type->name;
            // Give pages a higher priority.
            $priority = ('page' == $post_type->name) ? 'core' : 'default';
            add_meta_box("add-post-type-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type);
        }
    }
}

WordPress Version: 4.6

/**
 * Creates meta boxes for any post type menu item..
 *
 * @since 3.0.0
 */
function wp_nav_menu_post_type_meta_boxes()
{
    $post_types = get_post_types(array('show_in_nav_menus' => true), 'object');
    if (!$post_types) {
        return;
    }
    foreach ($post_types as $post_type) {
        /**
         * Filters whether a menu items meta box will be added for the current
         * object type.
         *
         * If a falsey value is returned instead of an object, the menu items
         * meta box for the current meta box object will not be added.
         *
         * @since 3.0.0
         *
         * @param object $meta_box_object The current object to add a menu items
         *                                meta box for.
         */
        $post_type = apply_filters('nav_menu_meta_box_object', $post_type);
        if ($post_type) {
            $id = $post_type->name;
            // Give pages a higher priority.
            $priority = ('page' == $post_type->name) ? 'core' : 'default';
            add_meta_box("add-post-type-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type);
        }
    }
}

WordPress Version: 4.4

/**
 * Creates metaboxes for any post type menu item.
 *
 * @since 3.0.0
 */
function wp_nav_menu_post_type_meta_boxes()
{
    $post_types = get_post_types(array('show_in_nav_menus' => true), 'object');
    if (!$post_types) {
        return;
    }
    foreach ($post_types as $post_type) {
        /**
         * Filter whether a menu items meta box will be added for the current
         * object type.
         *
         * If a falsey value is returned instead of an object, the menu items
         * meta box for the current meta box object will not be added.
         *
         * @since 3.0.0
         *
         * @param object $meta_box_object The current object to add a menu items
         *                                meta box for.
         */
        $post_type = apply_filters('nav_menu_meta_box_object', $post_type);
        if ($post_type) {
            $id = $post_type->name;
            // Give pages a higher priority.
            $priority = ('page' == $post_type->name) ? 'core' : 'default';
            add_meta_box("add-post-type-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type);
        }
    }
}

WordPress Version: 4.0

/**
 * Creates metaboxes for any post type menu item.
 *
 * @since 3.0.0
 */
function wp_nav_menu_post_type_meta_boxes()
{
    $post_types = get_post_types(array('show_in_nav_menus' => true), 'object');
    if (!$post_types) {
        return;
    }
    foreach ($post_types as $post_type) {
        /**
         * Filter whether a menu items meta box will be added for the current
         * object type.
         *
         * If a falsey value is returned instead of an object, the menu items
         * meta box for the current meta box object will not be added.
         *
         * @since 3.0.0
         *
         * @param object $meta_box_object The current object to add a menu items
         *                                meta box for.
         */
        $post_type = apply_filters('nav_menu_meta_box_object', $post_type);
        if ($post_type) {
            $id = $post_type->name;
            // Give pages a higher priority.
            $priority = ('page' == $post_type->name) ? 'core' : 'default';
            add_meta_box("add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type);
        }
    }
}

WordPress Version: 3.8

/**
 * Creates metaboxes for any post type menu item.
 *
 * @since 3.0.0
 */
function wp_nav_menu_post_type_meta_boxes()
{
    $post_types = get_post_types(array('show_in_nav_menus' => true), 'object');
    if (!$post_types) {
        return;
    }
    foreach ($post_types as $post_type) {
        /**
         * Filter whether a menu items meta box will be added for the current post type.
         *
         * If a falsey value is returned instead of a post type object,
         * the post type menu items meta box will not be added.
         *
         * @since 3.0.0
         *
         * @param object $post_type The post type object to be used as a meta box.
         */
        $post_type = apply_filters('nav_menu_meta_box_object', $post_type);
        if ($post_type) {
            $id = $post_type->name;
            // give pages a higher priority
            $priority = ('page' == $post_type->name) ? 'core' : 'default';
            add_meta_box("add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type);
        }
    }
}

WordPress Version: 3.7

/**
 * Creates metaboxes for any post type menu item.
 *
 * @since 3.0.0
 */
function wp_nav_menu_post_type_meta_boxes()
{
    $post_types = get_post_types(array('show_in_nav_menus' => true), 'object');
    if (!$post_types) {
        return;
    }
    foreach ($post_types as $post_type) {
        $post_type = apply_filters('nav_menu_meta_box_object', $post_type);
        if ($post_type) {
            $id = $post_type->name;
            // give pages a higher priority
            $priority = ('page' == $post_type->name) ? 'core' : 'default';
            add_meta_box("add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type);
        }
    }
}