• Resolved Matt Pritchett

    (@mrpritchett)


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

Viewing 1 replies (of 1 total)
  • Thread Starter Matt Pritchett

    (@mrpritchett)

    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.