How to query with get_posts() for posts with any tag

You could try this.

$all_tags = get_tags();
$tag_id = array();
foreach( $all_tags as $tag ) {
    $tag_id[] = $tag->term_id;
}

$args = array(
    'numberposts' => 5,
    'tag__in' => $tag_id
);
$myposts = get_posts( $args );

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)