<p>Found it!!! Used ElementQuery::EVENT_AFTER_PREPARE</p>

CC BY-SA 4.0
2021-02-03T06:01:17.110Z
2021-02-03T06:01:17.110Z
Ram
<p>I was referring to <a href="https://craftcms.stackexchange.com/questions/19575/filter-entries-in-the-cp-based-on-custom-permission">Filter entries in the CP based on custom permission</a> and <a href="https://craftcms.stackexchange.com/questions/19575/filter-entries-in-the-cp-based-on-custom-permission">Filter entries in the CP based on custom permission</a></p>
<p>It seems onBuildElementsQuery was available only in 2.x.
Is there any alternative for craft 3.x?</p>

<plugin-development><control-panel><events><security><hook>
Apply custom filter on the entries in admin control panel using custom plugin in craft cms 3.5
# Apply custom filter on the entries in admin control panel using custom plugin in craft cms 3.5

(Asked by: username_0 on 2021-01-30)

I was referring to [Filter entries in the CP based on custom permission](https://craftcms.stackexchange.com/questions/19575/filter-entries-in-the-cp-based-on-custom-permission) and [Filter entries in the CP based on custom permission](https://craftcms.stackexchange.com/questions/19575/filter-entries-in-the-cp-based-on-custom-permission)

It seems onBuildElementsQuery was available only in 2.x.
Is there any alternative for craft 3.x?

**Tags:** plugin-development, control-panel, events, security, hook

---

## 1 answers

### Answer by username_0 on 2021-02-03. Score: 2 | Accepted answer

Found it!!! Used ElementQuery::EVENT\_AFTER\_PREPARE


---

