Apply a filter only once
There is no native WordPress hook called add_filter_once(). This is an custom solution which will help you to run your hook only once. For example if inside a loop or whatever situation you are facing. However, The basic idea is to check when you need to stop using your hook and simply remove_hook from WordPress … Read more