CPTUI Causes critical error messages: PHP Warning: Invalid argument supplied
-
Hello first of all thanks for the awesome Plugin:)
I have a Problem with my CPT UI installation. i Honestly dont know what happend, but i think the error accoured when i created a new post type a while ago. I tried to fix it the last 4 days but with no luck
I Recieve the following error message from my Logs:
/public_html/wp-content/plugins/custom-post-type-ui/custom-post-type-ui.php on line 611PHP message: PHP Warning: Invalid argument supplied for foreach()
im not very familiar with coding but i looked up the costum-post-type-ui.php file and on the line 611 following code is shown (with the few following lines):
foreach ( $taxonomy['labels'] as $key => $label ) { if ( ! empty( $label ) ) { $labels[ $key ] = $label; } elseif ( empty( $label ) && in_array( $key, $preserved, true ) ) { $singular_or_plural = ( in_array( $key, array_keys( $preserved_labels['taxonomies']['plural'] ) ) ) ? 'plural' : 'singular'; $label_plurality = ( 'plural' === $singular_or_plural ) ? $taxonomy['label'] : $taxonomy['singular_label']; $labels[ $key ] = sprintf( $preserved_labels['taxonomies'][ $singular_or_plural ][ $key ], $label_plurality ); }
The following Line is also mentioned in the error log:
/public_html/wp-content/plugins/custom-post-type-ui/custom-post-type-ui.php on line 381PHP message: PHP Warning: Invalid argument supplied for foreach()
Wich calls another thing:
foreach ( $post_type['labels'] as $key => $label ) { if ( ! empty( $label ) ) { if ( 'parent' === $key ) { $labels['parent_item_colon'] = $label; } else { $labels[ $key ] = $label; } } elseif ( empty( $label ) && in_array( $key, $preserved, true ) ) { $singular_or_plural = ( in_array( $key, array_keys( $preserved_labels['post_types']['plural'] ) ) ) ? 'plural' : 'singular'; $label_plurality = ( 'plural' === $singular_or_plural ) ? $post_type['label'] : $post_type['singular_label']; $labels[ $key ] = sprintf( $preserved_labels['post_types'][ $singular_or_plural ][ $key ], $label_plurality ); }
it seems like something went wrong with a argument “foreach” but i dont know what caused it… there was nothing changed with other post types and i am not really sure what caused it. i did not do any updates recently.
i have searched this forum trought and tried some things wich where similar i have tried the following things in the following order:-Deactivating all other plugins (It seems CPTUI is causing it)
-Deactivating and reactivating CPTUI (Still no change)
-Updated the settings for permalinks (Did not work tried multiple times)
-imported the post type code blob ( Was suggested in another post in this forum)
-Deleted the new created post types (After that didnt work i restored to a backup i did before deleting the new post types)
-Reinstalled CPTUI
Here is a code blob from the cptui settings:
{"dj_portfolios":{"name":"dj_portfolios","label":"Dj Portfolios","singular_label":"Dj Portfolio","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"true","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"true","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"","supports":["title","editor","thumbnail","excerpt","trackbacks","custom-fields","comments","revisions","author","page-attributes","post-formats"],"taxonomies":["artist_type"],"labels":{"menu_name":"Dj Portfolios","all_items":"All Dj Portfolios","add_new":"Add new","add_new_item":"Add new Dj Portfolio","edit_item":"Edit Dj Portfolio","new_item":"New Dj Portfolio","view_item":"View Dj Portfolio","view_items":"View Dj Portfolios","search_items":"Search Dj Portfolios","not_found":"No Dj Portfolios found","not_found_in_trash":"No Dj Portfolios found in trash","parent":"Parent Dj Portfolio:","featured_image":"Featured image for this Dj Portfolio","set_featured_image":"Set featured image for this Dj Portfolio","remove_featured_image":"Remove featured image for this Dj Portfolio","use_featured_image":"Use as featured image for this Dj Portfolio","archives":"Dj Portfolio archives","insert_into_item":"Insert into Dj Portfolio","uploaded_to_this_item":"Upload to this Dj Portfolio","filter_items_list":"Filter Dj Portfolios list","items_list_navigation":"Dj Portfolios list navigation","items_list":"Dj Portfolios list","attributes":"Dj Portfolios attributes","name_admin_bar":"Dj Portfolio","item_published":"Dj Portfolio published","item_published_privately":"Dj Portfolio published privately.","item_reverted_to_draft":"Dj Portfolio reverted to draft.","item_scheduled":"Dj Portfolio scheduled","item_updated":"Dj Portfolio updated.","parent_item_colon":"Parent Dj Portfolio:"},"custom_supports":""},"dj_service":{"name":"dj_service","label":"Dj Services","singular_label":"Dj Service","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"true","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"true","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"","supports":["title","editor","thumbnail","excerpt","trackbacks","custom-fields","comments","revisions","author","page-attributes","post-formats"],"taxonomies":[],"labels":null,"custom_supports":""},"foto_portfolio":{"name":"foto_portfolio","label":"Foto Portfolios","singular_label":"Foto Portfolio","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"true","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"true","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"dashicons-camera-alt","supports":["title","editor","thumbnail","excerpt","custom-fields","revisions","author","page-attributes","post-formats"],"taxonomies":["all_artists_types"],"labels":{"menu_name":"My Foto Portfolios","all_items":"All Foto Portfolios","add_new":"Add new","add_new_item":"Add new Foto Portfolio","edit_item":"Edit Foto Portfolio","new_item":"New Foto Portfolio","view_item":"View Foto Portfolio","view_items":"View Foto Portfolios","search_items":"Search Foto Portfolios","not_found":"No Foto Portfolios found","not_found_in_trash":"No Foto Portfolios found in trash","parent":"Parent Foto Portfolio:","featured_image":"Featured image for this Foto Portfolio","set_featured_image":"Set featured image for this Foto Portfolio","remove_featured_image":"Remove featured image for this Foto Portfolio","use_featured_image":"Use as featured image for this Foto Portfolio","archives":"Foto Portfolio archives","insert_into_item":"Insert into Foto Portfolio","uploaded_to_this_item":"Upload to this Foto Portfolio","filter_items_list":"Filter Foto Portfolios list","items_list_navigation":"Foto Portfolios list navigation","items_list":"Foto Portfolios list","attributes":"Foto Portfolios attributes","name_admin_bar":"Foto Portfolio","item_published":"Foto Portfolio published","item_published_privately":"Foto Portfolio published privately.","item_reverted_to_draft":"Foto Portfolio reverted to draft.","item_scheduled":"Foto Portfolio scheduled","item_updated":"Foto Portfolio updated.","parent_item_colon":"Parent Foto Portfolio:"},"custom_supports":""},"video_portfolios":{"name":"video_portfolios","label":"Video Portfolios","singular_label":"Video Portfolio","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"true","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"true","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"dashicons-video-alt2","supports":["title","editor","thumbnail","excerpt","trackbacks","custom-fields","revisions","author","page-attributes","post-formats"],"taxonomies":[],"labels":{"menu_name":"My Video Portfolios","all_items":"All Video Portfolios","add_new":"Add new","add_new_item":"Add new Video Portfolio","edit_item":"Edit Video Portfolio","new_item":"New Video Portfolio","view_item":"View Video Portfolio","view_items":"View Video Portfolios","search_items":"Search Video Portfolios","not_found":"No Video Portfolios found","not_found_in_trash":"No Video Portfolios found in trash","parent":"Parent Video Portfolio:","featured_image":"Featured image for this Video Portfolio","set_featured_image":"Set featured image for this Video Portfolio","remove_featured_image":"Remove featured image for this Video Portfolio","use_featured_image":"Use as featured image for this Video Portfolio","archives":"Video Portfolio archives","insert_into_item":"Insert into Video Portfolio","uploaded_to_this_item":"Upload to this Video Portfolio","filter_items_list":"Filter Video Portfolios list","items_list_navigation":"Video Portfolios list navigation","items_list":"Video Portfolios list","attributes":"Video Portfolios attributes","name_admin_bar":"Video Portfolio","item_published":"Video Portfolio published","item_published_privately":"Video Portfolio published privately.","item_reverted_to_draft":"Video Portfolio reverted to draft.","item_scheduled":"Video Portfolio scheduled","item_updated":"Video Portfolio updated.","parent_item_colon":"Parent Video Portfolio:"},"custom_supports":""},"graphic_portfolios":{"name":"graphic_portfolios","label":"Graphic Portfolios","singular_label":"Graphic Portfolio","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"true","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"true","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"dashicons-edit","supports":["title","editor","thumbnail","excerpt","trackbacks","custom-fields","revisions","author","page-attributes","post-formats"],"taxonomies":[],"labels":null,"custom_supports":""},"graphic_services":{"name":"graphic_services","label":"Graphic Services","singular_label":"Graphic Service","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"true","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"true","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"dashicons-edit","supports":["title","editor","thumbnail","excerpt","trackbacks","custom-fields","revisions","author","page-attributes","post-formats"],"taxonomies":[],"labels":null,"custom_supports":""},"katalog":{"name":"katalog","label":"Katalog","singular_label":"Katalog","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"true","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"false","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"","supports":["title","editor","thumbnail"],"taxonomies":["kleidung"],"labels":null,"custom_supports":""},"foto_services":{"name":"foto_services","label":"Foto Services","singular_label":"Foto Service","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"true","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"true","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"dashicons-camera-alt","supports":["title","editor","thumbnail","excerpt","custom-fields","revisions","author","page-attributes","post-formats"],"taxonomies":[],"labels":null,"custom_supports":""},"video_service":{"name":"video_service","label":"Video Services","singular_label":"Video Service","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"true","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"true","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"dashicons-video-alt2","supports":["title","editor","thumbnail","excerpt","trackbacks","custom-fields","revisions","author","page-attributes","post-formats"],"taxonomies":[],"labels":null,"custom_supports":""},"grafik-showroom":{"name":"grafik-showroom","label":"Grafik Design Showrooms","singular_label":"Grafik Design Showroom","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"true","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"true","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"","supports":["title","editor","thumbnail","none"],"taxonomies":[],"labels":{"menu_name":"","all_items":"","add_new":"","add_new_item":"","edit_item":"","new_item":"","view_item":"","view_items":"","search_items":"","not_found":"","not_found_in_trash":"","parent_item_colon":"","featured_image":"","set_featured_image":"","remove_featured_image":"","use_featured_image":"","archives":"","insert_into_item":"","uploaded_to_this_item":"","filter_items_list":"","items_list_navigation":"","items_list":"","attributes":"","name_admin_bar":"","item_published":"","item_published_privately":"","item_reverted_to_draft":"","item_scheduled":"","item_updated":""},"custom_supports":""},"grafik-content":{"name":"grafik-content","label":"grafik design content","singular_label":"grafik designs content","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"false","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"false","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"","supports":["title","editor","thumbnail"],"taxonomies":[],"labels":{"menu_name":"","all_items":"","add_new":"","add_new_item":"","edit_item":"","new_item":"","view_item":"","view_items":"","search_items":"","not_found":"","not_found_in_trash":"","parent_item_colon":"","featured_image":"","set_featured_image":"","remove_featured_image":"","use_featured_image":"","archives":"","insert_into_item":"","uploaded_to_this_item":"","filter_items_list":"","items_list_navigation":"","items_list":"","attributes":"","name_admin_bar":"","item_published":"","item_published_privately":"","item_reverted_to_draft":"","item_scheduled":"","item_updated":""},"custom_supports":""},"video_showroom":{"name":"video_showroom","label":"Video Showrooms","singular_label":"Video Showroom","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"false","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"false","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"","supports":["title","editor","thumbnail","none"],"taxonomies":[],"labels":{"menu_name":"","all_items":"","add_new":"","add_new_item":"","edit_item":"","new_item":"","view_item":"","view_items":"","search_items":"","not_found":"","not_found_in_trash":"","parent_item_colon":"","featured_image":"","set_featured_image":"","remove_featured_image":"","use_featured_image":"","archives":"","insert_into_item":"","uploaded_to_this_item":"","filter_items_list":"","items_list_navigation":"","items_list":"","attributes":"","name_admin_bar":"","item_published":"","item_published_privately":"","item_reverted_to_draft":"","item_scheduled":"","item_updated":""},"custom_supports":""},"video_content":{"name":"video_content","label":"Video Content","singular_label":"Videos Content","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"false","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"false","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"","supports":["title","editor","thumbnail","none"],"taxonomies":[],"labels":{"menu_name":"","all_items":"","add_new":"","add_new_item":"","edit_item":"","new_item":"","view_item":"","view_items":"","search_items":"","not_found":"","not_found_in_trash":"","parent_item_colon":"","featured_image":"","set_featured_image":"","remove_featured_image":"","use_featured_image":"","archives":"","insert_into_item":"","uploaded_to_this_item":"","filter_items_list":"","items_list_navigation":"","items_list":"","attributes":"","name_admin_bar":"","item_published":"","item_published_privately":"","item_reverted_to_draft":"","item_scheduled":"","item_updated":""},"custom_supports":""},"costum_services":{"name":"costum_services","label":"Costum Services","singular_label":"Costum Service","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"true","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"false","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"","supports":["title","editor","thumbnail","excerpt","trackbacks","custom-fields","revisions","author","page-attributes","post-formats"],"taxonomies":[],"labels":null,"custom_supports":""}}
i hope you can help me out i tired to fix this for the last seven days:(
Kind regards
LiamThe page I need help with: [log in to see the link]
- The topic ‘CPTUI Causes critical error messages: PHP Warning: Invalid argument supplied’ is closed to new replies.