0

ランダム投稿リンクの簡単なスニペットを書きました。

function ex_get_random_post_link ()
{
    $args = array(
        'posts_per_page' => 1,
        'ignore_sticky_posts' => true,
        'post_type' => 'post',
        'orderby' => 'rand'
        );

    $query = new WP_Query($args);
    $query->the_post();
    return get_permalink();
}

しかし、投稿形式なしの投稿のみを取得したい。

4

1 に答える 1