[英]Sort the admin area of a Wordpress custom post type by a custom field
It was easy enough to get my custom fields to show up as columns in the wp-admin area of my custom post type but now I need to sort by one of those custom fields. 使自定义字段显示为自定义帖子类型的wp-admin区域中的列很容易,但是现在我需要按这些自定义字段之一进行排序。 Any ideas?
有任何想法吗?
But of course. 但是当然。 This will sort posts by the value of the
pant_size
custom field: 这将按照
pant_size
自定义字段的值对帖子进行排序:
$posts = query_posts('orderby=meta_value&meta_key=pant_size&order=DESC');
You can read more about it in this article . 您可以在本文中阅读有关它的更多信息。
希望答案会最终出现在Wordpress stackexchange网站上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.