WordPress comes with some helper functions for finding a theme’s path and/or URI, which are tremendously useful but I always have to look them up. Therefore, I’m making note of them here so I know where to look them up.
Note: All of these functions return a string that does NOT include a closing slash (/
)
Child Theme Path
get_stylesheet_directory()
/app/public/wp-content/themes/mychildtheme
Child Theme URI
get_stylesheet_directory_uri()
get_stylesheet_directory_uri()
https://example.com/wp-content/themes/mychildtheme
Parent Theme Path
get_template_directory()
/app/public/wp-content/themes/parent
Parent Theme Path
get_template_directory_uri()
https://example.com/wp-content/themes/parent
Leave a Reply