Title: Invalid taxonomy when using get_terms
Last modified: August 21, 2016

---

# Invalid taxonomy when using get_terms

 *  [ralphonz](https://wordpress.org/support/users/ralphonz/)
 * (@ralphonz)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/invalid-taxonomy-when-using-get_terms/)
 * hi everyone,
 * I have developed a working template which uses a custom taxonomy “restaurant_menus”.
 * I making a variation of the theme to display to mobile devices however the same
   code does’t retrieve the taxonomy for the mobile template and if i print the 
   object i see: `WP_Error Object ( [errors] => Array ( [invalid_taxonomy] => Array([
   0] => Invalid taxonomy ) ) [error_data] => Array ( ) )`
 * the code i’m using is:
 *     ```
       <?php $taxonomy = 'restaurant_menu';
       		$terms = get_terms( $taxonomy, array('parent' => 0) );
       		if ($terms) : ?>
   
       		<article id="Menus">
   
       			<h1><?php _e('Menus', 'bigLampBrewery') ?></h1>
   
       			<img class="alignright menu-image" src="<?php echo get_stylesheet_directory_uri(); ?>/img/Keelman_Menus.jpg" alt="The Keelman Restaurant Menus" width="169px" height="253px">
   
       			<?php foreach($terms as $term) { ?>
   
       		    	<div class="menu-select row" id="<?php echo $term->term_id; ?>">
       		    		<span><?php echo $term->name ; ?></span> 
   
       		    		<span class="description"><?php echo $term->description ; ?></span>
   
       		    		<a class="button" href="<?php  echo esc_attr(get_term_link($term, $taxonomy));  ?>" title="View Menu" ><?php _e('View Menu', 'BigLampBrewery') ?></a> 
   
       		    	</div><!--menu-select-->
   
       			<?php } ?>
   
       			<br class="clear" />
   
       		</article><!-- /menus-->
       ```
   
 * Can anyone explain why this doesn’t work?
 * Thanks

The topic ‘Invalid taxonomy when using get_terms’ is closed to new replies.

## Tags

 * [custom taxonomy](https://wordpress.org/support/topic-tag/custom-taxonomy/)
 * [get_terms](https://wordpress.org/support/topic-tag/get_terms/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [ralphonz](https://wordpress.org/support/users/ralphonz/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/invalid-taxonomy-when-using-get_terms/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
