• I’ve added an hook to switch a post type from ‘post’ to ‘lodging’ and when I add the code below I can’t add items to the menu. The menu item title is something like ‘#78 (no title)’ and when I save it I get the message ‘The given object ID is not that of a menu item’.
    The code is:

    add_action('save_post', 'gp_save_post');
    
    function gp_save_post($post_id) {
        $type_to_switch = $_POST['type_to_switch'];
        set_post_type($post_id, $type_to_switch);
    }

    If I remove this code all works fine.

  • The topic ‘The given object ID is not that of a menu item’ is closed to new replies.