Title: order_by &amp; in_same_meta
Last modified: August 21, 2016

---

# order_by & in_same_meta

 *  Resolved [clecocq](https://wordpress.org/support/users/clecocq/)
 * (@clecocq)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/order_by-in_same_meta/)
 * Hello!
 * Thanks for the job done on this plugin.
 * I have a question, I’ve notice this: “Please note that in_same_meta is not compatible
   with custom field sorting. If order_by is set to either ‘custom’ or ‘numeric’,
   in_same_meta is disabled.”
 * However, I definitely need it. Is there a way to get this working?
 * My code:
 *     ```
       <?php $nextPost = next_post_link_plus( array(
       					'return' => 'href',
       					'post_type' => ' "artup_galeristes","artup_medias","artup_editeurs","artup_autres","artup_structures" ',
       					'in_same_meta' => 'artup-valider-exposant',
       					/*'order_by' => 'custom',
       					'meta_key' => 'artup-ordre-exposant',*/
       					'loop' => true
       				)
       			); ?>
       ```
   
 * Thanks in advance
 * [http://wordpress.org/plugins/ambrosite-nextprevious-post-link-plus/](http://wordpress.org/plugins/ambrosite-nextprevious-post-link-plus/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [ambrosite](https://wordpress.org/support/users/ambrosite/)
 * (@ambrosite)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/order_by-in_same_meta/#post-4359139)
 * The only way that would be possible is with a correlated subquery. There is some
   discussion and an example given here, in case you want to try hacking the plugin
   code:
 * [http://www.ambrosite.com/plugins/next-previous-post-link-plus-for-wordpress#comment-9523](http://www.ambrosite.com/plugins/next-previous-post-link-plus-for-wordpress#comment-9523)
 * My post there talks about querying two different categories at the same time,
   but the principle could be extended to custom fields.
 *  Thread Starter [clecocq](https://wordpress.org/support/users/clecocq/)
 * (@clecocq)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/order_by-in_same_meta/#post-4359196)
 * Oups sorry but I’m really really not familiar with SQL.
 * Can you help with this? It will be another example for the community… 🙂
 * Where to replace this in your plugin? which line?
    How to do? Any chance that
   you help constructing this subquery and tell me where to put it?
 * Code is
 *     ```
       <?php $nextPost = next_post_link_plus( array(
       					'return' => 'href',
       					'post_type' => ' "artup_galeristes","artup_medias","artup_editeurs","artup_autres","artup_structures" ',
       					'in_same_meta' => 'artup-valider-exposant',
       					/*'order_by' => 'custom',
       					'meta_key' => 'artup-ordre-exposant',*/
       					'loop' => true
       				)
       			); ?>
       ```
   
 * I need to order_by by artup-ordre-exposant but in the same time I have to control
   that artup-valider-exposant is true (it’s a boolean).
 * Your plugin is really interesting, but I’m stuck with this and my customer waits
   for a solution.
 * Thanks in advance for your help,
 * Cyril
 *  Plugin Author [ambrosite](https://wordpress.org/support/users/ambrosite/)
 * (@ambrosite)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/order_by-in_same_meta/#post-4359218)
 * Cyril, I am sorry but it would take at least an hour to code and test this properly.
   It’s too much for a freebie, especially if you are doing this for a client. Besides
   that, I am on vacation at the moment (it is the Thanksgiving holiday here in 
   the US). If you want to contact me off forum, I’ll try to work out something 
   reasonable with you.
 *  Thread Starter [clecocq](https://wordpress.org/support/users/clecocq/)
 * (@clecocq)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/order_by-in_same_meta/#post-4359233)
 * Hi,
 * I understand don’t worry 😉 it’s normal.
 * Happy thanksgiving by the way.
 * I contact you off forum.
 * Cyril

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘order_by & in_same_meta’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ambrosite-nextprevious-post-link-
   plus.svg)
 * [Ambrosite Next/Previous Post Link Plus](https://wordpress.org/plugins/ambrosite-nextprevious-post-link-plus/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ambrosite-nextprevious-post-link-plus/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ambrosite-nextprevious-post-link-plus/)
 * [Active Topics](https://wordpress.org/support/plugin/ambrosite-nextprevious-post-link-plus/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ambrosite-nextprevious-post-link-plus/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ambrosite-nextprevious-post-link-plus/reviews/)

## Tags

 * [order_by](https://wordpress.org/support/topic-tag/order_by/)

 * 4 replies
 * 2 participants
 * Last reply from: [clecocq](https://wordpress.org/support/users/clecocq/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/order_by-in_same_meta/#post-4359233)
 * Status: resolved