Wordpress Multisite - add function to functions.php to only affect 1 site


Staff member
I am running a wordpress multisite with 2 blogs ( site1.com and site2.com )

The entire site is sharing the same theme as well as the functions.php file.

I have the following filter that I need to put into the function.php file, but I need this filter to only affect 1 blog - site2.com

The filter is as follows :

add_filter( 'get_manager_nav', 'set_manager_nav' );

function set_manager_nav( $urls ) {
    return $urls;

Is there a way to apply this filter only to 1 site ??

What I have done instead is that I have created a new plugin, I have added the function to the plugin and activated the plugin only on site2.com.

It is working great, but I suppose using a simple snippet is much better than using a plugin, so is there a way to do this using a snippet ?