I would like to get relative path from a php file without knowing the absolute path. I have succeeded to do it but for a reason which I don't know, on some servers (in rare case) it doesn't work when I enqueue css/js. Slashes are missing...
Here the code:
define('PATH', trailingslashit(str_replace('\\', '/', dirname(__FILE__)))); define('URI', site_url(str_replace(trailingslashit(str_replace('\\', '/',ABSPATH)), '', PATH)))
What did I miss? Does it come from the server or the code itself?