WordPress函数文档admin_url()
返回后台管理地址 描述 The admin_url template tag retrieves the ur…
返回后台管理地址
描述
The admin_url template tag retrieves the url to the admin area for the current site with the appropriate protocol, ‘https’ if is_ssl() and ‘http’ otherwise. If scheme is ‘http’ or ‘https’, is_ssl() is overridden.
In case of WordPress Network setup, use network_admin_url() instead.
用法
<?php admin_url( $path, $scheme ); ?>
Default Usage
<?php $url = admin_url(); ?>
参数
$path
(string) (可选) Path relative to the admin url.
默认值: None
$scheme
(string) (可选) The scheme to use. Default is ‘admin’, which obeys force_ssl_admin() and is_ssl(). ‘http’ or ‘https’ can be passed to force those schemes. The function uses get_site_url(), so allowed values include any accepted by that function.
默认值: ‘admin’
示例
1
2
3
4
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
echo admin_url();
|
Output: http://www.example.com/wp-admin/
(protocol will be https when appropriate)
1
2
3
4
5
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
// generate url path to admin’s “Add new page” , and force https
echo admin_url( ‘edit-tags.php?taxonomy=category’, ‘https’ );
|
Output: https://www.example.com/wp-admin/edit-tags.php?taxonomy=category
注意
- 使用到 get_admin_url()
相关
WordPress Directories: | ||
---|---|---|
home_url() | Home URL | http://www.example.com |
site_url() | Site directory URL | http://www.example.com or http://www.example.com/wordpress |
admin_url() | Admin directory URL | http://www.example.com/wp-admin |
includes_url() | Includes directory URL | http://www.example.com/wp-includes |
content_url() | Content directory URL | http://www.example.com/wp-content |
plugins_url() | Plugins directory URL | http://www.example.com/wp-content/plugins |
theme_url() | Themes directory URL (#18302) | http://www.example.com/wp-content/themes |
wp_upload_dir() | Upload directory URL (returns an array) | http://www.example.com/wp-content/uploads |
- 原文:http://codex.wordpress.org/Function_Reference/admin_url
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
评论功能已经关闭!