Title: Function is not defined
Last modified: March 20, 2017

---

# Function is not defined

 *  [splatweb](https://wordpress.org/support/users/splatweb/)
 * (@splatweb)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/function-is-not-defined/)
 * The function is not defined when I try to call it. Please help.
 *     ```
       		<?php 
       		$terms = get_terms(
       			array(
       				'taxonomy' => 'product_categories',
       				'hide_empty' => false
       			)
       		);
   
       		echo '<pre>';
       		print_r($terms);
   
       		$i = 0;
   
       		foreach($terms as $term) {
   
       			if($i=0)
       			{
       			?>
   
       				<div class="product-categories left">
   
       					<div class="category-image">
   
       						<?php
       						if (function_exists('get_wp_term_image'))
       						{
       						    $meta_image = get_wp_term_image($term->term_id); 
       						}
       						?>
   
       						<?php echo $meta_image; ?>	
   
       					</div>
   
       					<div class="category-text">
   
       						<?php echo $term->description; ?>
   
       					</div>
   
       				</div>
   
       			<?php
       			} else {
       			?>
   
       				<div class="product-categories right">
   
       					<div class="category-image">
   
       						<?php
       						if (function_exists('get_wp_term_image'))
       						{
       						    $meta_image = get_wp_term_image($term->term_id); 
       						}
       						?>
   
       						<?php echo $meta_image; ?>	
   
       					</div>
   
       					<div class="category-text">
   
       						<?php echo $term->description; ?>
   
       					</div>
   
       				</div>
   
       			<?php
       			}
   
       			echo $term->term_id;
   
       		}
       		?>
       ```
   

The topic ‘Function is not defined’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-custom-taxonomy-image_4c878c.svg)
 * [Category and Taxonomy Image](https://wordpress.org/plugins/wp-custom-taxonomy-image/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-custom-taxonomy-image/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-custom-taxonomy-image/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-custom-taxonomy-image/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-custom-taxonomy-image/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-custom-taxonomy-image/reviews/)

## Tags

 * [function](https://wordpress.org/support/topic-tag/function/)
 * [image](https://wordpress.org/support/topic-tag/image/)

 * 0 replies
 * 1 participant
 * Last reply from: [splatweb](https://wordpress.org/support/users/splatweb/)
 * Last activity: [9 years, 2 months ago](https://wordpress.org/support/topic/function-is-not-defined/)
 * Status: not resolved