最近在研究wordpress的时候,用到一些url路径,比如首页的路径,我直接把路径的地址添上去了,比如当前网址的路径:https://www.xiariboke.net,后来查了一下,原来 wordpress 中提供了许多默认的URL路径函数,直接调用就可以了,下面整理的几个常用的URL路径。,plugins_url() — 插件目录的 URL (例如:https://www.xiariboke.net/wp-content/plugins),includes_url() — includes 目录的 URL (例如:https://www.xiariboke.net/wp-includes),content_url() — content 目录的 URL (例如:https://www.xiariboke.net/wp-content),admin_url() — admin 目录的 URL (例如:https://www.xiariboke.net/wp-admin/),site_url() — 当前网站的 URL (例如:https://www.xiariboke.net),home_url() — 当前网站首页的 URL (例如:https://www.xiariboke.net),在调用的时候最好使用这些自定义好的函数,这样显得更规范一些,而且使用的好处还有在更改域名后不用再去单独更改文件了,wordpress中较常用的路径还有许多,,

最近在研究wordpress的时候,用到一些url路径,比如首页的路径,我直接把路径的地址添上去了,比如当前网址的路径:https://www.xiariboke.net,后来查了一下,原来 wordpress 中提供了许多默认的URL路径函数,直接调用就可以了,下面整理的几个常用的URL路径。

plugins_url() — 插件目录的 URL (例如:https://www.xiariboke.net/wp-content/plugins)

includes_url() — includes 目录的 URL (例如:https://www.xiariboke.net/wp-includes)

content_url() — content 目录的 URL (例如:https://www.xiariboke.net/wp-content)

admin_url() — admin 目录的 URL (例如:https://www.xiariboke.net/wp-admin/)

site_url() — 当前网站的 URL (例如:https://www.xiariboke.net)

home_url() — 当前网站首页的 URL (例如:https://www.xiariboke.net)

在调用的时候最好使用这些自定义好的函数,这样显得更规范一些,而且使用的好处还有在更改域名后不用再去单独更改文件了,wordpress中较常用的路径还有许多,

,

最近在研究wordpress的时候,用到一些url路径,比如首页的路径,我直接把路径的地址添上去了,比如当前网址的路径:https://www.xiariboke.net,后来查了一下,原来 wordpress 中提供了许多默认的URL路径函数,直接调用就可以了,下面整理的几个常用的URL路径。

plugins_url() — 插件目录的 URL (例如:https://www.xiariboke.net/wp-content/plugins)

includes_url() — includes 目录的 URL (例如:https://www.xiariboke.net/wp-includes)

content_url() — content 目录的 URL (例如:https://www.xiariboke.net/wp-content)

admin_url() — admin 目录的 URL (例如:https://www.xiariboke.net/wp-admin/)

site_url() — 当前网站的 URL (例如:https://www.xiariboke.net)

home_url() — 当前网站首页的 URL (例如:https://www.xiariboke.net)

在调用的时候最好使用这些自定义好的函数,这样显得更规范一些,而且使用的好处还有在更改域名后不用再去单独更改文件了,wordpress中较常用的路径还有许多,

最后修改:2025 年 09 月 10 日
如果觉得我的文章对你有用,请随意夸赞