‘template_url‘ / ‘template_directory‘ – URL of the active theme’s directory. Within child themes, both get_bloginfo(‘template_url’) and get_template() will return the parent theme directory. Consider echoing get_template_directory_uri() instead (for the parent template directory) or get_stylesheet_directory_uri() (for the child template directory).
Source: https://developer.wordpress.org/reference/functions/bloginfo/
the function get_template_directory_uri()
is the better one, if you want to support creating child themes. if you don’t care, it shouldn’t matter much.
edit:
did a simple speed test and found no significant difference:
blog_info('template_url') 0.00010 sec
get_template_directory_uri() 0.00007-0.00010 sec
Related Posts:
- How can I get a link path to use for my resources such as JS scripts?
- What is procedure to let set path in wordpress?
- What setting should I configure to move new site folder?
- How to add a breadcrumb to WordPress header?
- proper syntax of getting wp-admin pages/links
- Absolute path in WordPress Network site
- Why can’t the WP-CLI installer find my php.ini?
- Including $_SERVER[‘DOCUMENT_ROOT’] to load files outside of wordpress installation doesn’t work remotely
- How to get the path to the current theme?
- When moving a WP site, why does wp-admin redirect to old site?
- Symbolic Links on dev box with plugins and stylesheets
- Setting a custom sub-path for blog without using pages?
- Change the path where wordpress plugins are uploaded
- How to display a raw HTML page (bypassing WordPress theme, scripts, etc)
- How do I ‘rebuild’ the WordPress Media library after transfer to new host?
- Which method is best to enqueue scripts
- How to get WordPress to save upload file beyond web root [closed]
- How to call plugin path in JS?
- Absolute Path (ABSPATH) in WordPress is not working
- Hook filter to change wp_upload_dir() path in multisite
- How to inject custom url path for page ?
- WordPress login page logo customization
- Migrating a File from Plugin to Theme and changing its path → instead create a REST endpoint
- Retrieve Path of admin.php
- Why doesn’t WP_PLUGIN_DIR definition use DIRECTORY_SEPARATOR?
- Plugin base URL
- Wrong path for theme assets
- Get uploaded image url
- Remove ‘wp-content/themes/themename/’ from Image path
- Alias ‘wp-content’ directory to something shorter (framework?)
- Problem with loading images from child theme CSS file with relevant path
- Components used in Themes and Plugins: How to get file URL?
- WP Paths in a Plugin – how to include
- plugins_url function mixes system path and URL
- How much control do we have over CPT rewrite slugs? Can I create a “root” page for my CPT with out the page path, and then have paths for other pages?
- Changing the server path
- Get the path of the first attached media (single.php)
- Pulling images from a subdomain
- Can I have /blog and /foo and /bar all point to the same blog?
- Get posts from taxonomy URL
- Current path on page in functions.php
- What is the correct way to convert the absolute path of the executing script to a URL, in WordPress?
- How do I test my localhost WordPress project with VirtualBoxVM?
- Added slug after URL permalink last slash returns different content
- Images are searched in the wrong path
- Why is server preventing admin styles? (Was: Where are WordPress sessions saved?)
- wp_enqueue_script not loading my custom js file
- How to get path or root of plugin folder, not file or dir?
- How to have a custom URI path for specific page template
- Images give 404 after changing default domain
- Add custom path to url to specific pages
- specifying relative file paths in WP with jQuery requests not working
- Plugin path comes wrongly
- Apply template by path/slug related to custom post type?
- Correct Plugin File Path
- Hardcoded paths in my plugin
- get_attached_file returns wrong path after changing media upload dir
- php – Plugin/theme relative PATH/URI
- Background image appears on localhost site but not online
- Relative URLs within site
- wordpress admin part is not accesbile after server shifting
- WordPress VIP realpath Alternative?
- Is it possible to have a Theme with built-in physical page files?
- Absolute paths in backend for plugins after moving wordpress
- WordPress Relative Path
- Loading Images from Javascript on the Front End
- How to declare/provide file path in JQuery which is emeeded in the WordPress theme
- Path Issue – Getting “localhost” instead the IP
- How to add tags under categories
- Multisite problem with unexisting paths to CSS etc
- Apply function.php filter only if url not has /amp/
- How to route root path / to /xyz in nginx?
- Include my files in a plugin? [duplicate]
- I’m including a html file in my plugin, but it can’t find its css or js files
- path of wp-content directory when we are on some plugin
- I can’t load my images from a js file using wp_localize_script
- Right path for renaming a file in uploads folder
- Get not the full path
- Relative path not working at all in WAMP local environment
- Rewritten URL not loading WordPress environment
- Theme parts path location dump
- What paths does WordPress use for itself on a domain?
- Subpages return 404 server error
- Echo page path suffix only – not the title, path or permalink
- Image paths on custom post types getting /post_type/ added to path
- How to tell if a script is being executed from a plugin, a theme or a child theme in WordPress?
- Server Path Information
- Where do URI files come from?
- bloginfo no show the right path
- Include paths and functions for external scripts
- Path for contact form file
- Images in sub-pages fail to load
- How to prevent URL-modification when page title contains digits only?
- Img src path from wp-admin
- Register additional wp plugin directory
- Back button to previous page and breadcrumbs
- Absolute and relative paths
- WP-DBManager Plugin Can’t Find Mysql Path
- How to give path to files in plugins folder?
- Why isn’t my SVG path rotating on scroll on iPhones?