# Sort by likes in 2.5.0.beta6

**URL:** <https://meta.discourse.org/t/sort-by-likes-in-2-5-0-beta6/154333>\
**Category:** Product Support\
**Created:** [9 ביוני,‏ 2020,‏ 6:46pm UTC](https://meta.discourse.org/t/sort-by-likes-in-2-5-0-beta6/154333 "2020-06-09T18:46:44Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)\
**Post date:** [10 ביוני,‏ 2020,‏ 5:10pm UTC](https://meta.discourse.org/t/sort-by-likes-in-2-5-0-beta6/154333/3 "2020-06-10T17:10:35Z")

</div>

Hmm, I didn’t immediately run into the same error when trying it out. With that said, the code you linked to is quite old these days! I _think_ this should cover most of the modern patterns and achieve the same (or better) result. Can you give it a try, of course with values that make sense for your community?

```plaintext
<script type="text/discourse-plugin" version="0.10.0">
  const I18n = require("I18n").default;
  I18n.translations[I18n.locale].js.filters.topliked = { help: "Top Liked" };

  api.addNavigationBarItem({
    displayName: "Top Liked",
    name: "topliked",
    before: "top",
    href: "?order=op_likes&status=open",
    customFilter: category => {
      return category && category.name === "Testing"
    },
    forceActive: (category, args, router) => { 
        const queryParams = router.currentRoute.queryParams;
        return (
          queryParams &&
          Object.keys(queryParams).length === 2 &&
          queryParams["order"] === "op_likes" &&
          queryParams["status"] === "open"
        );
    }
  });
</script>

```

---

_[View the full topic](https://meta.discourse.org/t/sort-by-likes-in-2-5-0-beta6/154333)._
