JUMP TO EDIT8 TO SEE HOW I SOLVED THIS
Let\'s say I have a Wordpress blog: www.animals.com. I have a certain PHP file in my t
URL rewriting wouldn't work for me, neither by calling add_filter('rewrite_rules_array', function() {}), nor by calling add_rewrite_rule(). Apparently that was because filter 'rewrite_rules_array' was never triggered when opening frontend website pages, so the rewrites weren't generated.
The solution was to go to admin area and just open page Settings -> Permalinks. I need to do that every time I want to change my rewrites.
I don't know if vanilla Wordpress works like that, this is probably caused by an plugin/theme a have installed.