Custom Field Suite
[resolved] Custom Field Suite - sort by (5 posts)

  1. consumedesign
    Posted 3 years ago #

    Any chance I can get my WP_Query to sort by a CFS field and value? I use &meta_key=a_custom_meta_here&orderby=meta_value with my other sites but this client is hell bent on using CFS.


  2. consumedesign
    Posted 3 years ago #

    NM, see that it adds a meta_key in the postmeta as well.

  3. logikal16
    Plugin Author

    Posted 3 years ago #

    Yep :)

    We'll also be adding a custom Query function to handle any advanced queries that WP_Query can't do.

  4. LiliwoL
    Posted 2 years ago #

    Hi Logikal16!

    Is that custom query function done in last 1.5 version of Custom Field suite plugin?

    How to order by a custom field then?

    Thanks a lot

  5. logikal16
    Plugin Author

    Posted 2 years ago #

    @LiliwoL - it's possible to sort by custom field value using WP's built-in WP_Query() function. It would look something like this:

    $query = new WP_Query(
            'orderby' => 'meta_value',
            'meta_key' => 'YOUR_CUSTOM_FIELD_NAME',
            'order' => 'DESC'

    See http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Field Suite
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic