WordPress filter hook · part of WordPress core
site_url
A WordPress core filter that 11 plugins also fire themselves, running on 133K+ sites between them.
“Filters the site URL.”
How to use site_url
It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'site_url', function( $url, $path, $orig_scheme ) {
// Change $url here.
return $url;
}, 10, 3 );Argument names come from WP JW Player's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
11 plugins that fire site_url
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Defender Security80,000+ installs
apply_filters( 'site_url', $url, $path, $scheme, $blog_id )src/controller/class-mask-login.php:623 -
SecuPress with Simple SSL40,000+ installs
apply_filters( 'site_url', get_option( 'siteurl' ), '', null, null )free/functions/common.php:2548 -
SP Move Login6,000+ installs
apply_filters( 'site_url', get_option( 'siteurl' ), '', null, null )free/functions/common.php:1743 -
Themify Builder6,000+ installs
apply_filters( 'site_url', get_option('siteurl'), '', null, null )themify/cache/class-themify-cache.php:555 -
Parse.ly1,000+ installs
apply_filters( 'site_url', get_option( 'siteurl' ), '', null, null )src/Utils/class-utils.php:416 -
WP JW Player60+ installs
apply_filters( 'site_url', $url, $path, $orig_scheme )plugin.php:212 -
Sniplets30+ installs
apply_filters( 'site_url', $url, $path, $orig_scheme )plugin.php:211 -
Filled In20+ installs
apply_filters( 'site_url', $url, $path, $orig_scheme )plugin.php:215 -
DragDropr10+ installs
apply_filters( 'site_url', $url, $path, $scheme, $blog_id )lib/ddr-class-wp-rest-oauth1-admin.php:376 -
ICanLocalize Translator10+ installs
apply_filters( 'site_url', $url, $path, $orig_scheme )inc/rpc-functions.php:288 -
UBB MasterFewer than 10 installs
apply_filters( 'site_url', $url, $path, $orig_scheme )base/search-plugin.php:212
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.