• I’m working on a plugin which will insert postmeta data describing the attributes set in the Page Parent meta_box during a page creation work cycle. Right now I am hung up trying to track the origin/method used to create an appropriate value for the postmeta field: _menu_item_object_id. Can anyone give me a clue where I would begin to look to resolve this?

    public function save_menu_metadata($post_id) {
    
    	if ( 'fixture' != $_POST['post_type'] && 'page' != $_POST['post_type'] ) {
    	    return;
    	}
    	if ( !current_user_can( 'edit_pages', $post_id ) ) {
    	    return;
    	}
    
    	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', '');
            }
    }

    Any help appreciated.
    ~ Erik

The topic ‘Generate new value for _menu_item_object_id ?’ is closed to new replies.