admin管理员组文章数量:1278912
I need to do a get_posts() to fetch a list of "product" type posts, but when I do it on edit.php?post_type=mycustompost it returns empty. If I just simply do the same function but on edit.php (posts index page) it returns properly.
add_action('admin_head', 'custom_admin_head');
function custom_admin_head() {
$args = array(
'post_type' => 'product',
'posts_per_page' => 30,
);
$products = get_posts($args);
In this example
on edit.php?post_type=mycustompost... $products is empty
on edit.php... $products has 30 entries
How do I get it to return all 30 entries on the custom post type edit.php in wp-admin?
本文标签: getposts() returns empty on custom post type wpadmineditphp
版权声明:本文标题:get_posts() returns empty on custom post type wp-adminedit.php 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741224874a2361668.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论