码迷,mamicode.com
首页 > Web开发 > 详细

wordpress 获取指定作者的所有 post meta

时间:2019-12-04 13:39:10      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:_id   like   pos   bsp   author   ase   tle   ESS   int   

 $args = array( 
    ‘post_type‘ => array( ‘post‘,‘knowledgebase‘), 
    ‘post_status‘ => ‘publish‘,
    ‘author‘    =>  $author_id,
    ‘numberposts‘=> $author_all_posts
);
post_title
$posts = get_posts($args);
$votes_likes_sum = 0;
for ($i = 0; $i < count($posts); $i++) {
    $votes_likes_sum += get_post_meta($posts[$i]->ID, ‘_votes_likes‘, true);
}
echo $votes_likes_sum;
$post = $posts[0];
echo $post->ID;
print get_post_meta(1357, ‘_votes_likes‘, true);

 

获取指定作者的所有 Post Meta 信息

wordpress 获取指定作者的所有 post meta

标签:_id   like   pos   bsp   author   ase   tle   ESS   int   

原文地址:https://www.cnblogs.com/ryanzheng/p/11982036.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!