我想收到最近的帖子,我使用wp_get_recent_posts:
<?php $args = array(
'numberposts' => '3',
'post_status' => 'publish',
'orderby' => 'rand'
);
$recent_posts = wp_get_recent_posts($args);?>
然后我想在页面上显示帖子信息:
<?php foreach( $recent_posts as $recent ){?>
<li>
<?php echo the_category('/','',$recent["ID"]); ?>
<?php echo get_permalink($recent["ID"]) ?>
<?php echo $recent["post_title"]?></h2>
<?php echo get_the_date('F j, Y',$recent["ID"])?>
<?php echo get_the_post_thumbnail($recent["ID"],'bereza-carousel');?>
</li>
<?php
}?>
但必须正确转义所有动态数据。那么我怎样才能正确地逃避数据?