Array warning for cptui_post_thumbnail_theme_support php 8.3.14
-
Warning: foreach() argument must be of type array|object, false given in /plugins/custom-post-type-ui/inc/utility.php on line 1015
Of course it’s not exactly on line 1015 but in that function.function cptui_post_thumbnail_theme_support() {
$post_types = cptui_get_post_type_data();
// Check if $post_types is an array before proceeding
if ( ! is_array( $post_types ) ) {
return; // Exit early if it's not an array
}
$supported = [];
foreach ( $post_types as $post_type ) {
if ( empty( $post_type['supports'] ) ) {
continue;
}
if (
is_array( $post_type['supports'] ) &&
in_array( 'thumbnail', $post_type['supports'] )
) {
$supported[] = $post_type['name'];
}
}
if ( ! empty( $supported ) ) {
add_theme_support( 'post-thumbnails', $supported );
}
}?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Array warning for cptui_post_thumbnail_theme_support php 8.3.14’ is closed to new replies.