Title: Modify Query to sort using dropdown
Last modified: March 21, 2021

---

# Modify Query to sort using dropdown

 *  Resolved [djekanovic](https://wordpress.org/support/users/djekanovic/)
 * (@djekanovic)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/modify-query-to-sort-using-dropdown/)
 * Hey,
 * So I am trying to achieve this, to modify query and sort by likes by choosing
   that in dropdown. I am not sure if i need pro version to do it or I’m doing something
   wrong?
 * * I am using Elementor with Archive Posts widget, and Custom post type, however
   i changed rel_type to my post type accordingly.
 * [https://wordpress.org/support/topic/sort-by-likes-with-orderby/](https://wordpress.org/support/topic/sort-by-likes-with-orderby/)
 * Maybe this code needs a little tweak?
 * I get the response via form with this url: ?sort=orderby%3Dlikes
 * Thank you,
    Dimitrije
    -  This topic was modified 5 years, 2 months ago by [djekanovic](https://wordpress.org/support/users/djekanovic/).

Viewing 1 replies (of 1 total)

 *  Thread Starter [djekanovic](https://wordpress.org/support/users/djekanovic/)
 * (@djekanovic)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/modify-query-to-sort-using-dropdown/#post-14212787)
 * Okay, I’ve found the issue, the form was giving the wrong url
 * It needs to be corrected to ?orderby=likes
 * I’ve modified html in this way to make it work
 *     ```
       <form>
   
       <select name="orderby" id="orderby" onchange="document.location.href=\'?\' + this.options[this.selectedIndex].value" class="archive_sort_dropdown">
       [...]
           <option value="likes" class="archive_sort_dropdown_item" >Most liked</option>
       [...]
       </select>
   
       <input type="submit">
   
       </form>
       ```
   
 * And that works perfectly!
 * I’ll post on that thread where original answer is for the record.
 * Thanks for a great plugin, and not limiting it to pro 🙂
    -  This reply was modified 5 years, 2 months ago by [djekanovic](https://wordpress.org/support/users/djekanovic/).

Viewing 1 replies (of 1 total)

The topic ‘Modify Query to sort using dropdown’ is closed to new replies.

 * ![](https://ps.w.org/wp-ulike/assets/icon.svg?rev=2453069)
 * [WP ULike – Like & Dislike Buttons for Engagement and Feedback](https://wordpress.org/plugins/wp-ulike/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-ulike/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-ulike/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-ulike/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-ulike/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-ulike/reviews/)

## Tags

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

 * 1 reply
 * 1 participant
 * Last reply from: [djekanovic](https://wordpress.org/support/users/djekanovic/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/modify-query-to-sort-using-dropdown/#post-14212787)
 * Status: resolved