block_core_navigation_get_most_recently_published_navigation

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

WordPress Version: 6.3

/**
 * Finds the most recently published `wp_navigation` Post.
 *
 * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_most_recently_published_navigation() instead.
 *
 * @return WP_Post|null the first non-empty Navigation or null.
 */
function block_core_navigation_get_most_recently_published_navigation()
{
    _deprecated_function(__FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::get_most_recently_published_navigation');
    // Default to the most recently created menu.
    $parsed_args = array('post_type' => 'wp_navigation', 'no_found_rows' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'order' => 'DESC', 'orderby' => 'date', 'post_status' => 'publish', 'posts_per_page' => 1);
    $navigation_post = new WP_Query($parsed_args);
    if (count($navigation_post->posts) > 0) {
        return $navigation_post->posts[0];
    }
    return null;
}

WordPress Version: 6.2

/**
 * Finds the most recently published `wp_navigation` Post.
 *
 * @return WP_Post|null the first non-empty Navigation or null.
 */
function block_core_navigation_get_most_recently_published_navigation()
{
    // Default to the most recently created menu.
    $parsed_args = array('post_type' => 'wp_navigation', 'no_found_rows' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'order' => 'DESC', 'orderby' => 'date', 'post_status' => 'publish', 'posts_per_page' => 1);
    $navigation_post = new WP_Query($parsed_args);
    if (count($navigation_post->posts) > 0) {
        return $navigation_post->posts[0];
    }
    return null;
}

WordPress Version: 6.1

/**
 * Finds the most recently published `wp_navigation` Post.
 *
 * @return WP_Post|null the first non-empty Navigation or null.
 */
function block_core_navigation_get_most_recently_published_navigation()
{
    // We default to the most recently created menu.
    $parsed_args = array('post_type' => 'wp_navigation', 'no_found_rows' => true, 'order' => 'DESC', 'orderby' => 'date', 'post_status' => 'publish', 'posts_per_page' => 1);
    $navigation_post = new WP_Query($parsed_args);
    if (count($navigation_post->posts) > 0) {
        return $navigation_post->posts[0];
    }
    return null;
}