$random_args = [
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'rand',
'posts_per_page' => -1
'fields' => 'ids',
];
$random_query = new WP_Query($random_args);
$random_ids = $random_query->posts;
// основной запрос
$args = [
'posts_per_page' => 10,
'post__in' => $random_ids,
'orderby' => 'post__in' ,
];
$query = new WP_Query($args);
wp_enqueue_script('main', 'path', [], null, true);
wp_localize_script('main', 'php_data', ['homeUrl' => home_url()]);
const url = php_data.homeUrl;
wp_enqueue_style( 'visit_scripts');
$(".block").each(function() {
if ($(this).height() > 200) {
// показываем кнопку
} else {
// не показываем
}
});