Title: Get Terms issue
Last modified: August 21, 2016

---

# Get Terms issue

 *  Resolved [Matt Pritchett](https://wordpress.org/support/users/mrpritchett/)
 * (@mrpritchett)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/get-terms-issue/)
 * I am getting the error: Notice: Undefined offset: 0 in ../wp-includes/query.php
   on line 2258. The code giving me that error is below:
 *     ```
       <?php $sermon_series_terms = get_the_terms( $post->ID, 'sermon_series' );
           if ( $sermon_series_terms )
       	$sermon_series_term_slugs = wp_list_pluck( $sermon_series_terms, 'slug' );
       		$args = array(
       		'post_type' => 'sermons',
       		'order' => 'ASC',
       		'tax_query' => array(
       		array(
       		'taxonomy' => 'sermon_series',
       		'field' => 'slug',
       		'terms' => $sermon_series_term_slugs
       		)
       		)
       	);?>
       	<?php $my_query = new WP_Query(); $my_query->query($args); ?>
       	<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
       	<li><a href="<?php the_permalink(); ?>" style="font-style:normal;"><?php the_title(); ?></a></li>
       	<?php wp_reset_postdata(); endwhile; ?>
       ```
   
 * Basically I am trying to get all of the post titles within the current posts (
   on a custom post types single.php) custom taxonomy in a list. You can view the
   page at [http://mrp.trbc.org/trbc2013/sermons/living-in-the-margin/](http://mrp.trbc.org/trbc2013/sermons/living-in-the-margin/).

Viewing 1 replies (of 1 total)

 *  Thread Starter [Matt Pritchett](https://wordpress.org/support/users/mrpritchett/)
 * (@mrpritchett)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/get-terms-issue/#post-3892637)
 * Solved it by changing the first line to this:
    `<?php $sermon_series_terms = 
   wp_get_post_terms( $post->ID, 'sermon_series');`

Viewing 1 replies (of 1 total)

The topic ‘Get Terms issue’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [Matt Pritchett](https://wordpress.org/support/users/mrpritchett/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/get-terms-issue/#post-3892637)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
