$args = array(
'post_type' => 'post',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'post_tag',
'operator' => 'NOT EXISTS',
)
)
);
$query = new WP_Query;
$data = $query->query( $args );
foreach($data as $post){
echo $post->ID . " deleted<br>";
}
die();
<?php
/*
Template Name: All comments
*/
?>
<?php get_header(); ?>
<?php
$comments_per_page = 6;
$page = (!get_query_var('paged')) ? 1 : get_query_var('paged');
$params = array(
'offset' => ($page-1) * $comments_per_page,
'number' => $comments_per_page,
);
$comments = get_comments( $params );
foreach($comments as $comment){
echo "<div>";
echo "<p>",$comment->comment_author, "</p>";
echo "<p>",$comment->comment_date, "</p>";
echo "<p>",$comment->comment_content, "</p><br>";
echo "</div>";
}
$total_comments = get_comments(
array_merge($params,
array(
'count' => true,
'offset' => 0,
'number' => 0
)
)
);
$args = array(
'total' => ceil( $total_comments / $comments_per_page ),
'current' => max( 1, $page ),
'show_all' => false,
'end_size' => 1,
'mid_size' => 2,
'prev_next' => True,
'prev_text' => __('« Previous'),
'next_text' => __('Next »'),
'type' => 'plain'
);
echo paginate_links( $args );
?>
<?php get_footer(); ?>