How to get the URI to a theme without the domain. Example: /wp-content/themes/my-theme

I basically want the output of get_stylesheet_directory_uri(), but without http(s) and the domain.

2 Answers
2

Use parse_url(), because it exists exactly for that reason:

$path = parse_url( get_stylesheet_directory_uri(), PHP_URL_PATH );

Chris Cox’ solution will fail when the wp-content directory runs under a different domain than the rest of the site.

Leave a Comment