wp_reset_postdata

The timeline below displays how wordpress function wp_reset_postdata has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.3

/**
 * After looping through a separate query, this function restores
 * the $post global to the current post in the main query.
 *
 * @since 3.0.0
 *
 * @global WP_Query $wp_query WordPress Query object.
 */
function wp_reset_postdata()
{
    global $wp_query;
    if (isset($wp_query)) {
        $wp_query->reset_postdata();
    }
}

WordPress Version: 4.4

/**
 * After looping through a separate query, this function restores
 * the $post global to the current post in the main query.
 *
 * @since 3.0.0
 *
 * @global WP_Query $wp_query Global WP_Query instance.
 */
function wp_reset_postdata()
{
    global $wp_query;
    if (isset($wp_query)) {
        $wp_query->reset_postdata();
    }
}

WordPress Version: 4.3

/**
 * After looping through a separate query, this function restores
 * the $post global to the current post in the main query.
 *
 * @since 3.0.0
 *
 * @global WP_Query $wp_query
 */
function wp_reset_postdata()
{
    global $wp_query;
    if (isset($wp_query)) {
        $wp_query->reset_postdata();
    }
}

WordPress Version: 8.1

/**
 * After looping through a separate query, this function restores
 * the $post global to the current post in the main query.
 *
 * @since 3.0.0
 * @uses $wp_query
 */
function wp_reset_postdata()
{
    global $wp_query;
    if (isset($wp_query)) {
        $wp_query->reset_postdata();
    }
}

WordPress Version: 3.7

/**
 * After looping through a separate query, this function restores
 * the $post global to the current post in the main query.
 *
 * @since 3.0.0
 * @uses $wp_query
 */
function wp_reset_postdata()
{
    global $wp_query;
    $wp_query->reset_postdata();
}