Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress WordPress Theme Development Custom Post Type Templates in WordPress The Portfolio Homepage

Fatal error: Call to undefined function wp_reset_postdate()


$args = array( 
    'post_type' => 'portfolio'

$query = new WP_Query($args);


<section class="row no-max pad">

<?php if( $query -> have_posts() ): while( $query -> have_posts() ): $query -> the_post(); ?>

<div class="small-6 medium-4 large-3 columns grid-item">
    <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(''); ?></a>

<?php endwhile; endif; wp_reset_postdate(); ?>


can someone tell me what is causing this error

hey, wp_reset_postdata() is used in new php block and the error is gone but i would like to know reason if anyone knows help me out. Thank you in advance.

1 Answer

Kaitlyn Threndyle
Kaitlyn Threndyle
18,204 Points

Unless it was just an error when you copied the code into here, it seems you spelled it wp_reset_postdate(); instead of wp_reset_postdata();

Thank you