• Trying to write a plugin which will inject the appropriate values into wp_x_postmeta for a new menu item when a new page is added to a site. This is a MS installation. I have identified the meta_keys I need to reproduce, adn can come up with correct values for all of them except one: _menu_item_object_id. I can’t determine what the value ought to be for this key. Anyone?

    if (isset($_REQUEST['parent_id'])) {
    	update_post_meta($post_id, '_menu_item_type', 'post_type');
            update_post_meta($post_id, '_menu_item_menu_item_parent', $_REQUEST['parent_id']);
            update_post_meta($post_id, '_menu_item_object_id', ''); /* [TODO] */
            update_post_meta($post_id, '_menu_item_object', $_REQUEST['post_type']);
            update_post_meta($post_id, '_menu_item_target', '');
            update_post_meta($post_id, '_menu_item_classes', array(''));
            update_post_meta($post_id, '_menu_item_xfn', '');
            update_post_meta($post_id, '_menu_item_url', '');
        }
  • The topic ‘Nav menu insertion issue’ is closed to new replies.