I'm currently writing a WordPress plugin, and am looking to retrieve the WordPress admin url. It sounds simple enough - and it is - assuming every WordPress install is using the default wp-admin
slug; I could simply call get_admin_url()
, which is a wrapper for get_site_url()
, with wp-admin
hard-coded (see here: http://wpseek.com/function/get_admin_url/).
However, I don't want to work under an assumption that this url will never change. I'd like to be able to retrieve the url regardless of whether it's default or not; i.e. for either of these cases:
http://example.com/wp-admin
http://example.com/backend
One suggestion has been to allow the plugin user to define the admin url slug, should it be different from the default, but it would be better if there were some way to retrieve it without forcing the user to specify. I'd really appreciate any help on this.