Is it possible to bind a function to a filter hook via Ajax?

Is it possible to bind a function to a filter hook via Ajax?

No, because page requests are self contained.

When you request something from PHP, everything gets loaded from a fresh clean slate. At the end of the request, that slate is discarded.

This is different from say a Node application that is always running.

So, if you make an AJAX request and unhook a filter, it’s only unhooked for that request. A second page load, or AJAX request will not be affected by the unhooking, so it would need to be done on every request.

If you want something to persist across requests, you need to store it somewhere that persists, such as the database of the filesystem. Either way what you want to do won’t work, and there’s no change to WordPress or PHP you could make that would allow it to work the way you proposed.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)