Home › Forums › ACF PRO › Warning: Invalid argument "**" foreach "**" api-helpers.php on line 3213 › Reply To: Warning: Invalid argument "**" foreach "**" api-helpers.php on line 3213
Hi,
I can inform you, that the Error Messages are not caused from your Plugin.
I did overtake a website. I found in the functions a code, which provided an image gallery with “next / prev” Navigation. So every Image has its own URL.
define('ARBP_VERSION', '0.2');
define('ARBP_TYPE', 'ar_big_pictures');
define('ARBP_IMAGE_TYPE', 'ar_biggallery');
add_action('init', 'register_arbp_type');
//add_image_size(ARBP_IMAGE_TYPE, 930, 523, true);
add_filter( 'intermediate_image_sizes', function($sizes){
if (!isset($_REQUEST['post_id'])) { return; }
$type = get_post_type($_REQUEST['post_id']);
foreach($sizes as $key => $value){
/*if(($type == ARBP_TYPE && $value != ARBP_IMAGE_TYPE && $value != 'thumbnail')
|| ($type != ARBP_TYPE && $value == ARBP_IMAGE_TYPE)){*/
if ($type != ARBP_TYPE && $value == ARBP_IMAGE_TYPE) {
unset($sizes[$key]);
}
}
return $sizes;
});
function register_arbp_type() {
$labels = array(
'name' => 'Diashow',
'singular_name' => 'Diashow',
'add_new' => 'Neu',
'add_new_item' => 'Neue Diashow',
'edit_item' => 'Bearbeite Diashow',
'new_item' => 'Neue Diashow',
'all_items' => 'Alle Diashows',
'view_item' => 'Diashow betrachten',
'search_items' => 'Suche nach Diashows',
'not_found' => 'Keine Diashows gefunden',
'not_found_in_trash' => 'Keine Diashows im Papierkorb gefunde',
'parent_item_colon' => '',
'menu_name' => 'Diashows'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'diashow' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'taxonomies' => array('category'),
'supports' => array( 'title', 'editor', 'author', 'comments', 'excerpt', 'thumbnail' )
);
register_post_type(ARBP_TYPE , $args );
}
if (is_admin() && isset($_GET['post_type']) && $_GET['post_type'] == ARBP_TYPE) {
add_action( 'wp_print_scripts', 'ar_big_picts_de_script', 110 );
}
function ar_big_picts_de_script() {
wp_dequeue_script('wp-category-permalink.js');
wp_deregister_script('wp-category-permalink.js');
}
When I delete this Code, the Error Messages disappear.
Just because I’m corious – do you see where the Problem is?
Thanks a lot for your Help!
Best
Mikkel
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.