WordPress.org

Ready to get started?Download WordPress

Forums

Ultimate Taxonomy Manager
[resolved] Warning: Invalid argument supplied for foreach() on line 367 (2 posts)

  1. bitbusters
    Member
    Posted 2 years ago #

    Hi,
    Probably similarly to the warning in Ultimate Post Type Manager,
    I'm getting one after creating a taxonomy and marking it to show a combobox when creating a new post:

    Warning: Invalid argument supplied for foreach() in /public_html/wordpress/wp-content/plugins/ultimate-taxonomy-manager/ultimate-taxonomy-manager.php on line 367
    
    Warning: Invalid argument supplied for foreach() in /public_html/wordpress/wp-content/plugins/ultimate-taxonomy-manager/ultimate-taxonomy-manager.php on line 376

    The code affected is:

    if ( !function_exists( 'xydac_meta_boxes' ) ) {
    function xydac_meta_boxes(){
    
        $taxonomies = get_option("xydac_taxonomies");
            if (is_array($taxonomies) && !empty($taxonomies))
            foreach ($taxonomies  as $taxonomy )
            {
    
                if($taxonomy['showascombobox']=='true')
                {
                    if(xydac_tcheckbool($taxonomy['args']['hierarchical']))
                        {
                            foreach($taxonomy['object_type'] as $a) // line 367
                                remove_meta_box($taxonomy['name'].'div',$a,'core');
                        }
                    else
                        {
                            foreach($taxonomy['object_type'] as $a)// line 376
                                remove_meta_box('tagsdiv-'.$taxonomy['name'],$a,'core');
    
                        }
                        foreach($taxonomy['object_type'] as $a)
                        {add_meta_box($taxonomy['name'].'_box', __($taxonomy['args']['label']), 'xydac_meta_handler', $a, 'side', 'low', $taxonomy['name']);}
                }
            }
    }}

    This error did not occur in 2.3.1, and I think 3.3 was also OK. If anybody is able to help, it would be appreciated. Cheers.

    http://wordpress.org/extend/plugins/ultimate-taxonomy-manager/

  2. bitbusters
    Member
    Posted 2 years ago #

    Well, WOW - same fix repairs it ;)
    Lines 367 to 376 of ultimate-taxonomy-manager.php with (array) added:

    foreach((array)$taxonomy['object_type'] as $a)
                                remove_meta_box($taxonomy['name'].'div',$a,'core');
                        }
                    else
                        {
                            foreach((array)$taxonomy['object_type'] as $a)
                                remove_meta_box('tagsdiv-'.$taxonomy['name'],$a,'core');
    
                        }
                        foreach((array)$taxonomy['object_type'] as $a)

    Cheers!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic