WordPress get_bloginfo() Getting the active theme URL

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

<?php echo esc_url( get_bloginfo( 'stylesheet_directory' ) ); ?>

Output

http://example.com/wp-content/themes/twentysixteen

Alternatives

Internally, get_bloginfo( 'stylesheet_directory' ) calls get_stylesheet_directory_uri(), so you may want to use that instead:

<?php echo esc_url( get_stylesheet_directory_uri() ); ?>

Many developers prefer to use these dedicated functions because of inconsistent naming conventions between them and get_bloginfo(). For example, get_stylesheet_directory() returns the child theme path; however, as our previous example illustrates, get_bloginfo( 'stylesheet_directory' ) returns the child theme URL. If you use get_stylesheet_directory_uri() instead, there's less chance of confusion over whether you're retrieving a path or a URL.



Got any WordPress Question?