<?php
    /*
        Template Name: Last one
    */

    //die;

    $count = (int)get_option('lastonenode_count');
    $count = $count+1;
    update_option('lastonenode_count', $count);

    $posts = get_posts(
        array(
            'post_status' => 'publish',
            'post_type' => array('anew','profile_article','yellow'),
            'posts_per_page' => 1,
            'orderby' => 'date',
            'order' => 'DESC'
        )
    );

    //wp_redirect('https://profile.ru/archive/vremya-proverennogo-123132/',301);
    wp_redirect(get_permalink($posts[0]), 301);
    exit;

?>