Title: Undefined Variable Error (Version 3.0)
Last modified: April 30, 2024

---

# Undefined Variable Error (Version 3.0)

 *  Resolved [farnely](https://wordpress.org/support/users/farnely/)
 * (@farnely)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/undefined-variable-error-version-3-0/)
 * Latest version is throwing the following error:-
 * PHP Warning: Undefined variable $url_units in /wp-content/plugins/weather-atlas/
   includes/class-weather-atlas.php on line 1020

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Kristof Loyens Quantum Leap](https://wordpress.org/support/users/quantum-leap/)
 * (@quantum-leap)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/undefined-variable-error-version-3-0/#post-17735470)
 * Same problem here unfortunately.
   Giving the variable a default value if no value
   is set resolves the error.Steps to Resolve the Issue: **weather-atlas/includes/
   class-weather-atlas.php**Edit this file right above the 1020 line.
 *     ```wp-block-code
       // Steps to Resolve the Issue: Define $url_units Early in the Code:  Before the snippet you posted, ensure that $url_units is defined. This might be based on a setting in the plugin or a default value:
                               if ( !isset($url_units) ) {
                                       $url_units = '?units=metric'; // Or whatever default makes sense
                           }
   
   
                           // Add the link or branding to the footer
                           if ( $random_url <= 4 )
                           {
                               echo "<a href='" . esc_url( $url . $url_units ) . "' title='" . esc_attr( ${'city_name_' . $language_root_wp} ) . ", " . esc_attr( $country_name_abbr ) . " - " . esc_attr( $title ) . "' style='color:" . esc_attr( $text_color ) . "'>";
                               echo "<span class='weather-atlas-footer-block'>";
                               echo esc_html( ${'city_name_' . $language_root_wp} ) . ", " . esc_html( $country_name_abbr );
                               echo "</span>";
                               echo " " . esc_html( strtolower( $title ) ) . " ▸";
                               echo "</a>";
                           }
       ```
   
    -  This reply was modified 2 years, 1 month ago by [Kristof Loyens Quantum Leap](https://wordpress.org/support/users/quantum-leap/).
 *  Thread Starter [farnely](https://wordpress.org/support/users/farnely/)
 * (@farnely)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/undefined-variable-error-version-3-0/#post-17735896)
 * [@quantum-leap](https://wordpress.org/support/users/quantum-leap/)
    This isn’t
   the first time the developer/s have released a version containing basic coding
   errors and I doubt it will be the last. I got fed up of waiting for them to acknowledge
   the issue when I reported it let alone put it right and have now removed the 
   plugin from my site. But thanks to you for sharing the solution.
 *  Plugin Author [Weather Atlas](https://wordpress.org/support/users/weatheratlas/)
 * (@weatheratlas)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/undefined-variable-error-version-3-0/#post-17738975)
 * The bug has been fixed. Update to 3.0.1
 * Note: the bug does not appear in all WP versions/locations. Pls notify if more
   bugs appear, or this issue persists with your version.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Undefined Variable Error (Version 3.0)’ is closed to new replies.

 * ![](https://ps.w.org/weather-atlas/assets/icon-256x256.png?rev=1682546)
 * [Weather Atlas Widget](https://wordpress.org/plugins/weather-atlas/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/weather-atlas/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/weather-atlas/)
 * [Active Topics](https://wordpress.org/support/plugin/weather-atlas/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/weather-atlas/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/weather-atlas/reviews/)

## Tags

 * [PHP Warning](https://wordpress.org/support/topic-tag/php-warning/)

 * 3 replies
 * 3 participants
 * Last reply from: [Weather Atlas](https://wordpress.org/support/users/weatheratlas/)
 * Last activity: [2 years, 1 month ago](https://wordpress.org/support/topic/undefined-variable-error-version-3-0/#post-17738975)
 * Status: resolved