Title: Undefined variable: placeholder_color
Last modified: December 15, 2017

---

# Undefined variable: placeholder_color

 *  [Jonathan Stegall](https://wordpress.org/support/users/jonathanstegall/)
 * (@jonathanstegall)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/undefined-variable-placeholder_color/)
 * I’ve started using this plugin to lazy load images, including a custom method
   my theme uses for featured images. I noticed this issue on an article that doesn’t
   have a featured image at all, but I think the issue might occur in other situations
   as well.
 * In `/wp-content/plugins/easy-lazy-loader/easy-lazy-loader.php on line 652`, I
   get the error that `placeholder_color` is undefined.
 * Here’s how the code appears to be working:
 *     ```
       // use low res preview image as placeholder if applicable
       if ( 'lowres' === $placeholder_type && $img_id !== false ) {
       	$tiny_img_data  = wp_get_attachment_image_src( $img_id, $this->OPTIONS['placeholder_image_size'] );
       	$tiny_url = $tiny_img_data[0];
       	$placeholder_url_used = $tiny_url;
       }
       // use color as placeholder if applicable
       else if ( 'color' === $placeholder_type && class_exists( 'WordPress_Gallery_Extra' ) ) {
       	$placeholder_color = "";
   
       	if( $img_id !== false ) {
       		$placeholder_color = get_post_meta( $img_id, '_wgextra_dominant_color', true );
       	}
   
       	if ( !$placeholder_color ) {
       		$placeholder_color = $this->OPTIONS['default_image_placeholder_color'];
       	}
   
       	$placeholder_url_used = self::create_placeholder( $placeholder_color, (int) $width, (int) $height, 'Image loading...' );
       }
       // use transparent as placeholder if applicable
       else if ( 'default' === $placeholder_type && !is_string( $width ) && !is_string( $height ) ) {
       	$placeholder_url_used = self::create_placeholder( $placeholder_color, (int) $width, (int) $height );
       }
       ```
   
 * If I understand correctly, `placeholder_color` is only defined if `WordPress_Gallery_Extra`
   exists, but even if it does not exist, the plugin attempts to use it:
 *     ```
       // use transparent as placeholder if applicable
       else if ( 'default' === $placeholder_type && !is_string( $width ) && !is_string( $height ) ) {
       	$placeholder_url_used = self::create_placeholder( $placeholder_color, (int) $width, (int) $height );
       }
       ```
   
 * It doesn’t seem like anything is keeping this placeholder method from being called,
   while looking for a color value that may not exist.

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

 * ![](https://s.w.org/plugins/geopattern-icon/easy-lazy-loader_61c1ad.svg)
 * [Easy Lazy Loader](https://wordpress.org/plugins/easy-lazy-loader/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/easy-lazy-loader/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/easy-lazy-loader/)
 * [Active Topics](https://wordpress.org/support/plugin/easy-lazy-loader/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/easy-lazy-loader/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/easy-lazy-loader/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Jonathan Stegall](https://wordpress.org/support/users/jonathanstegall/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/undefined-variable-placeholder_color/)
 * Status: not resolved