This plugin hasn’t been tested with the latest three major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

Any Hostname


Any Hostname alters all WordPress-generated URLs according to the servers current hostname, so that they will always correspond to the actual hostname as entered by the user, as opposed to always using the URL specified in the WordPress options. The plugin is ideal for making a site available across multiple domains or running local development servers.

Known Issues

This plugin will not be able to alter the contents of constants such as WP_CONTENT_URL and WP_PLUGIN_URL as these are (quite naturally) defined before any plugins are loaded. Plugin developers should instead rely on either one of the plugins_url(), content_url() or get_option() functions, which will always return the filtered hostname. An example of this is the WPtouch plugin, in which case you can override WPtouch’s compat_get_wp_content_url function, as described by this Gist:

Any Hostname might also obscure the value of WordPress and Site URL settings on the Options » General settings page, due to the fact that these values are retrieved using the get_option() function. The values actually stored in WordPress’ database is in fact your site’s true URL. From 1.0b2 up the plugin will deactivate the host filters on this page, which might cause some page resources to load from the default URL (potentially being unreachable).

Any Hostname will not work on WordPress Network sites (WPMU) due to the fact that the pages in a network install stores its URLs explicitily in the database. Any ideas on how to circumvent this would be greatly appreciated.

Due to a bug in the WordPress Settings API ( the plugin settings are located on the Privacy page on WordPress versions below 3.5. From 3.5 and up the settings can be found on the Permalinks page.


Any Hostname has two filters, allowing you to programatically override the filtered hostname or the list of allowed hostnames. These are described below.


  • Arguments: $host (required)
  • Return value: $host (required)

Takes a host as argument, and returns a host that will be used when substituting the domain in URLs supplied by WordPress. This filter can be used to make the plugin use a specific host under certain circumstances.


  • Arguments: $hosts (required)
  • Return value: $hosts (required)

Takes an array of allowed hosts as argument, and returns an array of hosts to be used when checking if the user specified host should be allowed. Hosts should be treated as regular expression patterns.



  • Any Hostname settings


This section describes how to install the plugin and get it working.

  1. Upload the any-hostname directory to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Optionally edit the list of allowed hosts under ‘Options’ » ‘General’ (Privacy for WordPress versions below 3.5)


3 September 2016
Thank you for this plugin! It has saved me a lot of time Greetings from Berlin 🙂
Read all 2 reviews

Contributors and Developers

“Any Hostname” is open source software. The following people have contributed to this plugin.


Translate “Any Hostname” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Change Log


  • Added a setting for overriding the WordPress filter priority used for registering the URL overrides. Defaults to 20, but can be any value accepted by the add_filter()/remove_filter() functions. This can be helpful to solve priority conflicts with other plugins.


  • Added filter to the option option_theme_mods_{$current_theme_slug} to filter the URL to header image and background image when using for example get_header_image() or get_theme_mods() (Thanks to feedmeastraycat).
  • Added Ukranian localization (Thanks to Michael Yunat)


  • Due to a WordPress bug plugin settings have been moved to Settings / General.


  • Settings are now located under Settings / Permalinks on WordPress 3.5 or higher, as the Privacy page has been removed.
  • Bugfix for servers using HTTPS on redirected domains
  • Added slovak localization by Branco Radenovich of


  • Minor bugfixes and localization adjustments


  • Plugin is now using plugins_url() instead of its own filter in order to get the correct path for its javascript.
  • Added filters for plugins_url, content_url and upload_dir.
  • Fixed an issue with the URL filter for URLs that have a port number


  • Added localization support and Swedish localization.


  • Added host name caching, preventing a host from being evaluated against the regular expression patterns more than once per page load.
  • The plugin will nog disable host filters on the Options » General page in order to avoid obscuring the Site URL (home) and WordPress URL (siteurl) settings, potentially resulting in involuntary changing the sites default host name
  • The settings page will now display a warning when the list of allowed hosts does not include the current host.
  • Bug fix: Javascript needed used by the plugin on the admin pages will now also load from the filtered URL instead of WP_PLUGIN_URL


  • Initial Release