Skip to main content
Question Protected by fuxia
Tweeted twitter.com/#!/StackWordPress/status/418058505015545857
Corrected typo
Link
Krzysiek Dróżdż
  • 25.5k
  • 9
  • 53
  • 74

How to sort the admin area of a WordpressWordPress custom post type by a custom field

improved code formatting; links to Codex
Source Link
s_ha_dum
  • 65.5k
  • 13
  • 84
  • 174

When editing one of my custom post types I want to be able to list all entries by a custom field instead of the date they are published (which, for a custom post type probably isn't relevant). I got a lead from the comments of a blog post about custom post types and the author said it was possible and that he even made it so you could click on the column names for a custom sort. He mentioned the posts_orderbyposts_orderby function which I noted in my own comments but now I can find the blog post anymore. Any suggestions? I saw one solution that used

add_action('wp', 'check_page');

add_action('wp', 'check_page');

And the check_pagecheck_page function used add_filteradd_filter to change the query but I'm pretty sure it would only work in the theme files, not in the admin area.

When editing one of my custom post types I want to be able to list all entries by a custom field instead of the date they are published (which, for a custom post type probably isn't relevant). I got a lead from the comments of a blog post about custom post types and the author said it was possible and that he even made it so you could click on the column names for a custom sort. He mentioned the posts_orderby function which I noted in my own comments but now I can find the blog post anymore. Any suggestions? I saw one solution that used

add_action('wp', 'check_page');

And the check_page function used add_filter to change the query but I'm pretty sure it would only work in the theme files, not in the admin area.

When editing one of my custom post types I want to be able to list all entries by a custom field instead of the date they are published (which, for a custom post type probably isn't relevant). I got a lead from the comments of a blog post about custom post types and the author said it was possible and that he even made it so you could click on the column names for a custom sort. He mentioned the posts_orderby function which I noted in my own comments but now I can find the blog post anymore. Any suggestions? I saw one solution that used

add_action('wp', 'check_page');

And the check_page function used add_filter to change the query but I'm pretty sure it would only work in the theme files, not in the admin area.

Source Link
tooshel
  • 1.4k
  • 4
  • 18
  • 19

How to sort the admin area of a Wordpress custom post type by a custom field

When editing one of my custom post types I want to be able to list all entries by a custom field instead of the date they are published (which, for a custom post type probably isn't relevant). I got a lead from the comments of a blog post about custom post types and the author said it was possible and that he even made it so you could click on the column names for a custom sort. He mentioned the posts_orderby function which I noted in my own comments but now I can find the blog post anymore. Any suggestions? I saw one solution that used

add_action('wp', 'check_page');

And the check_page function used add_filter to change the query but I'm pretty sure it would only work in the theme files, not in the admin area.