Thread Starter
gpcola
(@gpcola)
To update my question with what looks like pertinent information following discussion on SO:
The custom post type in question is heirarchical and posts are being assigned a parent of another custom post type. I tried removing the link but it didn’t help.
The capability type is set to default of ‘post’. I tried setting to ‘page’ but it didn’t help.
It was suggested to print_r($queried_object); right before line 440 and here is the resulting output – note that there is no ‘ancestor’ in the object
stdClass Object ( [labels] => stdClass Object ( [name] => Vehicles [singular_name] => Vehicle [add_new] => Add New [add_new_item] => Add New Vehicle [edit_item] => Edit Vehicle [new_item] => New Vehicle [view_item] => View Vehicle [search_items] => Search Vehicles [not_found] => No Vehicles Found [not_found_in_trash] => No Vehicles found in Trash [parent_item_colon] => Operator [all_items] => Vehicles [menu_name] => Vehicles [name_admin_bar] => Vehicle ) [description] => Each vehicle is linked to an Operator [publicly_queryable] => 1 [exclude_from_search] => [capability_type] => post [map_meta_cap] => 1 [_builtin] => [_edit_link] => post.php?post=%d [hierarchical] => 1 [public] => 1 [rewrite] => Array ( [slug] => vehicle [with_front] => 1 [pages] => 1 [feeds] => 1 [ep_mask] => 1 ) [has_archive] => 1 [query_var] => [register_meta_box_cb] => [taxonomies] => Array ( [0] => category [1] => features [2] => colours [3] => drivers ) [show_ui] => 1 [menu_position] => [menu_icon] => [can_export] => 1 [show_in_nav_menus] => 1 [show_in_menu] => 1 [show_in_admin_bar] => 1 [delete_with_user] => [cctm_hierarchical_custom] => 1 [cctm_hierarchical_includes_drafts] => [cctm_hierarchical_post_types] => Array ( [0] => operator ) [cctm_custom_columns_enabled] => 0 [post_type] => vehicle [use_default_menu_icon] => 1 [label] => Vehicles [cctm_show_in_menu] => 1 [cctm_show_in_menu_custom] => [rewrite_with_front] => 1 [permalink_action] => /%postname%/ [rewrite_slug] => [include_in_search] => 1 [include_in_rss] => 1 [cctm_enable_right_now] => 1 [custom_order] => ASC [is_active] => 1 [custom_fields] => Array ( [0] => passenger_capacity [1] => luggage_capacity [2] => hourly_rate [3] => included_milleage [4] => additional_mileage_price [5] => additional_image ) [map_field_metabox] => Array ( [passenger_capacity] => cctm_vehicledetails [luggage_capacity] => cctm_vehicledetails [hourly_rate] => cctm_vehicledetails [included_milleage] => cctm_vehicledetails [additional_mileage_price] => cctm_vehicledetails [additional_image] => cctm_default ) [original_post_type_name] => vehicle [name] => vehicle [cap] => stdClass Object ( [edit_post] => edit_post [read_post] => read_post [delete_post] => delete_post [edit_posts] => edit_posts [edit_others_posts] => edit_others_posts [publish_posts] => publish_posts [read_private_posts] => read_private_posts [read] => read [delete_posts] => delete_posts [delete_private_posts] => delete_private_posts [delete_published_posts] => delete_published_posts [delete_others_posts] => delete_others_posts [edit_private_posts] => edit_private_posts [edit_published_posts] => edit_published_posts [create_posts] => edit_posts ) ) stdClass Object ( [labels] => stdClass Object ( [name] => Vehicles [singular_name] => Vehicle [add_new] => Add New [add_new_item] => Add New Vehicle [edit_item] => Edit Vehicle [new_item] => New Vehicle [view_item] => View Vehicle [search_items] => Search Vehicles [not_found] => No Vehicles Found [not_found_in_trash] => No Vehicles found in Trash [parent_item_colon] => Operator [all_items] => Vehicles [menu_name] => Vehicles [name_admin_bar] => Vehicle ) [description] => Each vehicle is linked to an Operator [publicly_queryable] => 1 [exclude_from_search] => [capability_type] => post [map_meta_cap] => 1 [_builtin] => [_edit_link] => post.php?post=%d [hierarchical] => 1 [public] => 1 [rewrite] => Array ( [slug] => vehicle [with_front] => 1 [pages] => 1 [feeds] => 1 [ep_mask] => 1 ) [has_archive] => 1 [query_var] => [register_meta_box_cb] => [taxonomies] => Array ( [0] => category [1] => features [2] => colours [3] => drivers ) [show_ui] => 1 [menu_position] => [menu_icon] => [can_export] => 1 [show_in_nav_menus] => 1 [show_in_menu] => 1 [show_in_admin_bar] => 1 [delete_with_user] => [cctm_hierarchical_custom] => 1 [cctm_hierarchical_includes_drafts] => [cctm_hierarchical_post_types] => Array ( [0] => operator ) [cctm_custom_columns_enabled] => 0 [post_type] => vehicle [use_default_menu_icon] => 1 [label] => Vehicles [cctm_show_in_menu] => 1 [cctm_show_in_menu_custom] => [rewrite_with_front] => 1 [permalink_action] => /%postname%/ [rewrite_slug] => [include_in_search] => 1 [include_in_rss] => 1 [cctm_enable_right_now] => 1 [custom_order] => ASC [is_active] => 1 [custom_fields] => Array ( [0] => passenger_capacity [1] => luggage_capacity [2] => hourly_rate [3] => included_milleage [4] => additional_mileage_price [5] => additional_image ) [map_field_metabox] => Array ( [passenger_capacity] => cctm_vehicledetails [luggage_capacity] => cctm_vehicledetails [hourly_rate] => cctm_vehicledetails [included_milleage] => cctm_vehicledetails [additional_mileage_price] => cctm_vehicledetails [additional_image] => cctm_default ) [original_post_type_name] => vehicle [name] => vehicle [cap] => stdClass Object ( [edit_post] => edit_post [read_post] => read_post [delete_post] => delete_post [edit_posts] => edit_posts [edit_others_posts] => edit_others_posts [publish_posts] => publish_posts [read_private_posts] => read_private_posts [read] => read [delete_posts] => delete_posts [delete_private_posts] => delete_private_posts [delete_published_posts] => delete_published_posts [delete_others_posts] => delete_others_posts [edit_private_posts] => edit_private_posts [edit_published_posts] => edit_published_posts [create_posts] => edit_posts ) )
Oof. That looks like a pain to troubleshoot since it’s referencing a built-in WP file. It doesn’t help you much, but I’ve seen plenty of cases where the wp core incorrectly handles custom post types. I’m not sure what I can do for you here… if it were me I’d start hacking the wp core until I found the culprit. I suspect it has something to do with the CCTM, so it may be worth doing trial and error testing here with various types of post-type definitions to see if you can narrow down the cause of the behavior.