• 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.