原文:
https://blog.csdn.net/u011675745/article/details/52791703
开发wordpress主题或者插件的时候,最忌讳的一点就是把地址写死了。这样的主题或者插件除了自己能用之外,别人根本就用不了。所以,强烈建议在需要使用地址和URL的场合使用Wordpress自带的各类用于查询地址和URL的函数
站点路径相关函数
home_url()
site_url()
admin_url()
content_url()
includes_url()
wp_upload_dir()
主题路径相关函数
get_theme_root_uri()
get_theme_root()
get_theme_roots()
get_stylesheet_directory()
get_stylesheet_directory_uri()
get_template_directory_uri()
get_template_directory()
get_template()
get_stylesheet()
plugins_url()
plugin_dir_url()
plugin_dir_path()
plugin_basename()
路径相关常量
WP_CONTENT_DIR
WP_CONTENT_URL
WP_PLUGIN_DIR
WP_PLUGIN_URL
TEMPLATEPATH
STYLESHEETPATH