• I newly installed your plugin today & it had a warning message right away that says: “Warning: Invalid argument supplied for foreach() in /home/myfolder/public_html/wp-content/plugins/wp-add-mime-types/includes/admin.php on line 61.”

    I think I found that line in the plugin editor, but I have no clue what would be causing the error… can you help me fix it please, and thank you!

    foreach ($mime_type_values as $line){
    $line_value = explode(“=”, $line);
    if(count($line_value) != 2) continue;

Viewing 4 replies - 1 through 4 (of 4 total)
  • It’s because the settings are empty the first time you’re coming in the interface. So PHP is unable to do a foreach loop because it’s empty.
    Solution

    if(!empty($mime_type_values)) {
    foreach ($mime_type_values as $line){
       $line_value = explode("=", $line);
       if(count($line_value) != 2) continue;
       $mimes[trim($line_value[0])] = trim($line_value[1]); 
    }   
    }

    Add an empty verification. Don’t forget the closing accolade.
    I just do it and it works well.

    Plugin Author kimipooh

    (@kimipooh)

    Thank you for your comment.
    I will fix it next version.

    Plugin Author kimipooh

    (@kimipooh)

    I released version 2.3.0.
    Please update it.

    Then, I added to ignore to the right of ‘#’ on a line ??

    Plugin Author kimipooh

    (@kimipooh)

    Sorry, I released version 2.2.0.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Warning Dialog After Installing Plugin’ is closed to new replies.