admin_url() wordpress function and usage This text is not used because the data attribute has a value

admin_url() wordpress function and usage

Home / WordPress / WordPress Wiki / admin_url() wordpress function and usage

admin_url( string $path = '', string $scheme = 'admin' )
Retrieves the URL to the admin area for the current site.

Parameters

$path

(string) (Optional) Path relative to the admin URL. Default ‘admin’.

Default value: ”

$scheme

(string) (Optional) 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.

Default value: ‘admin’

Return

(string) Admin URL link with optional path appended.

Sample Usage

Examples

<?php echo admin_url(); ?>

Output: http://example.com/wp-admin/ (or https protocol when appropriate)

// Generate URL to admin's "Categories" page, and force https
<?php echo admin_url( 'edit-tags.php?taxonomy=category', 'https' ); ?>

Output: https://example.com/wp-admin/edit-tags.php?taxonomy=category

Default Usage

<?php $url = admin_url(); ?>

 

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments