WordPress函数:wp_get_recent_posts()获取最新发表文章函数

追格官方小助手/ 2022年06月17日/ WordPress/ 浏览 986

WordPress按发表时间,检索数据库中最新发表文章,默认检索最近十篇文章。


函数用法:

<?php wp_get_recent_posts( $args ) ?>


函数参数:

<?php
$args = array(
           'numberposts' => 5,
    'offset' => 0,
    'category' => 0,
    'orderby' => 'post_date',
    'order' => 'DESC',
    'include' => ,
    'exclude' => ,
    'meta_key' => ,
    'meta_value' =>,
    'post_type' => 'post',
    'post_status' => 'draft, publish, future, pending, private',
    'suppress_filters' => true
    );
?>


函数所在目录:wp-includes/post.php

发表评论

暂无评论,抢个沙发...

客服 工单