如何在wordpress中基于元键订购自定义帖子admin

问题描述:

我有一个名为'Product'的元素键为'Prioritized'的自定义帖子。我在帖子中添加了很多草稿。现在,在管理员中,我想对帖子进行排序,以便按照用户列出产品列表。 我已经尝试过很多插件,但没有一个符合我的要求。我只想将那些发布和检查的帖子排序为优先。 这可能吗? 欢迎任何帮助/建议。 在此先感谢。如何在wordpress中基于元键订购自定义帖子admin

请尝试下面的代码

$args = array(
    'post_type'  => 'your-post-type', 
    'posts_per_page' => 1, 
    'post_status' => array('publish'), 
    'meta_key'  => 'your key name',//prioritized 
    'meta_value'  => 'your key value' 
); 

$the_query = new WP_Query($args); 

if ($the_query->have_posts()) : 
    while ($the_query->have_posts()) : $the_query->the_post(); 
     the_title(); 
    endwhile; 
endif; 
+1

这将是在网站的前端做到这一点的方法,但我对问题的理解是关于管理区域。 –

您可以通过this plugin显示作者和自定义字段列。我不确定你能否按这个字段排序行。