Title: Undefined variable warning
Last modified: November 4, 2025

---

# Undefined variable warning

 *  ResolvedPlugin Contributor [Earthman Media](https://wordpress.org/support/users/earthman100/)
 * (@earthman100)
 * [6 months, 3 weeks ago](https://wordpress.org/support/topic/undefined-variable-warning-4/)
 * This is filling up our logs:
 *     ```wp-block-code
       Undefined variable $is_allowed in wp_tota11y_js called at /code/wp-includes/class-wp-hook.php (324)
       ```
   
 * The culprit: `wp-content/plugins/wp-tota11y/wp-tota11y.php:48`
 *     ```wp-block-code
       /* Load JavaScript. */function wp_tota11y_js() {$allowed_roles = array( 'administrator' );// allow other plugins to modify these in a filter$allowed_roles = (array) apply_filters( 'wp_tota11y_allowed_roles', $allowed_roles );if ( is_user_logged_in() ) {$user = wp_get_current_user();$user_roles = $user->roles;foreach ( $user_roles as $role ) {if ( in_array( $role, $allowed_roles, true ) ) {$is_allowed = true;break;}}if ( $is_allowed ) {// Always load jQuery.wp_enqueue_script('jquery');// Load Tota11y.jswp_enqueue_script( 'wp-tota11y-js', plugins_url( '/js/tota11y.min.js', __FILE__ ), 'jquery', '1.2.0', true );}}}
       ```
   
 * The fix: Define the variable as false, first:
 *     ```wp-block-code
       /* Load JavaScript. */function wp_tota11y_js() {  $is_allowed = false;  $allowed_roles = array( 'administrator' );
       ```
   
 * Can you please resolve in your next update?

Viewing 1 replies (of 1 total)

 *  Plugin Author [Marcel Pol](https://wordpress.org/support/users/mpol/)
 * (@mpol)
 * [6 months, 3 weeks ago](https://wordpress.org/support/topic/undefined-variable-warning-4/#post-18707671)
 * Thank you, 1.3.1 is released.
   Regards, Marcel

Viewing 1 replies (of 1 total)

The topic ‘Undefined variable warning’ is closed to new replies.

 * ![](https://ps.w.org/wp-tota11y/assets/icon-256x256.png?rev=1274905)
 * [Tota11y WP](https://wordpress.org/plugins/wp-tota11y/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-tota11y/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-tota11y/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-tota11y/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-tota11y/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-tota11y/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Marcel Pol](https://wordpress.org/support/users/mpol/)
 * Last activity: [6 months, 3 weeks ago](https://wordpress.org/support/topic/undefined-variable-warning-4/#post-18707671)
 * Status: resolved