I have a little problem with my website, sorry for my noobish question, but I really can’t solve the issue:
How can I, using multisite, limit a function to only given site? I use such function to adapt homepage regarding user state:

    function switch_homepage() {
    if ( is_user_logged_in() ) {
        $page = 4284; // for logged in users
        update_option( 'page_on_front', $page );
        update_option( 'show_on_front', 'page' );
    } else {
        $page = 4133; // for logged out users
        update_option( 'page_on_front', $page );
        update_option( 'show_on_front', 'page' );
    }
}

I want the code to just work on a main site. Thanks for you help!

Read more here: (WordPress Multisite) Limit function to given sites


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: