How To Redesign with Oxygen Builder on a Live Site – without a Staging Site


Most advice I see on redesigning a live site with Oxygen is to create a completely separate staging site, as you would typically.

However Oxygen is quite unique. With Oxygen installed, the plugin overides not only the previous theme, but the content as well.  This means you can recreate your entire site with your new design and content on the same pages with Oxygen.

The way to do this is to enable Oxygen only for yourself for development (you will see Oxygen frontend and backend when logged in) and all logged out users will see the current version of the site and Oxygen will be completely invisible to them. This is done by uploading a php file (shown below). Then when you are ready to go live, simply remove that php file so that everyone sees the new version.

Please note that the standard way of redesigning a site with a staging site may be more appropriate in certain situations, such as if you are changing the plugins or functionality of your site. You will need to consider which is the best approach based on what changes you will be making.

Here is how to do it:

  1. Create a folder in your wp-content folder called mu-plugins
  2. Then in your mu-plugins folder create a php file called enable-oxygen-logged-in.php with this code below:
<?php
    add_filter( 'option_active_plugins', 'enable_oxygen_logged_in' );
        function enable_oxygen_logged_in( $plugins ) {
            require (ABSPATH . WPINC . '/pluggable.php');
            if ( !is_user_logged_in() ) {
            $plugins_not_needed = array ('oxygen/functions.php');
            foreach ( $plugins_not_needed as $plugin ) {
                $key = array_search( $plugin, $plugins );
                if ( false !== $key ) {
                   unset( $plugins[ $key ] );
                }
            }
        }
        return $plugins;
   }
?>

Thats it! 

The only issue I have come across is that if you are using FluentSMTP, the above code will prevent SMTP from working properly since both are using pluggable.php which causes a conflict. This is a known documented issue with FluentSMTP. In this case, the above code will work if you change to another SMTP plugin such as WP Mail SMTP by Wpforms (see Ian’s comment below – thanks Ian)

Do you need any other help with Oxygen? Contact us

Feel free to leave a comment below on your thoughts on this and if it worked for you.

30 Comments

  1. Sue

    Just did it – I’ll let you know how it works!

    Sue

    Reply
    • Sue

      It worked like a charm!

      Thanks,
      Sue

      Reply
      • Mastery Websites

        Great! Good to know this helped Sue.

        Reply
  2. Doug

    I created the PHP file in mu-plugins but it changes for the public side of the site not just for the one admin I placed in the file. On a tablet I checked the front end of the site and it showed the new oxygen rebuilding site not the original.

    Reply
    • Mastery Websites

      Hard to know why this is the case without taking a look.

      Reply
  3. Rebekah

    It allows non-logged-in users to view the old site normally, which is great. However, we are using Oxygen 1. We see the “Edit in visual Editor” button, but when we click it, none of the builder tools show and we are still getting the divi sidebar with no way to actually use Oxygen to build new pages.

    Reply
    • Mastery Websites

      Sounds like you are currently with Divi and want to setup your new site with Oxygen. I would recommend creating your new site with Oxygen 2, not Oxygen 1. See if that works.

      Reply
  4. VC

    I am trying this for on Oxygen 3.0 but its not working.

    Reply
    • Mastery Websites

      I made a fix, please copy that code and try again.

      Reply
    • Kathir

      Hey for the first time.i installed oxygen builder on my existing WordPress blog, suddenly my theme css broken and SEO plugin shows heading template has been changed..

      Will above solution fix it?

      Reply
      • Mastery Websites

        Yes it should.

        Reply
  5. Well Traveled Mile

    Hi, thanks for the tip! Everything worked, except that with Elementor installed the slug on the Oxygen editor screen shows:

    “https://welltraveledmile.com/?elementor_library=card-maximizer-header-footer&ct_builder=true”

    Is this an issue or will the elementor_library part be removed when I turn deactivate Elementor and delete the mu-plugin?

    Thanks!

    Reply
    • Mastery Websites

      I never did this with a Elementor site. Was it an issue in the end?

      Reply
  6. Svetlomir

    Hi, just followed your advise but once I upload the file in the directory mu-plugins the site shows ERROR 500 – Internal Server Error! I use the new Oxygen 3.6 and Astra theme. Any advise? Regards

    Reply
    • Mastery Websites

      I just tested it with Oxygen 3.6 and Astra theme and it works for me.

      Reply
  7. Winit

    It not working with my site. It appear white plain site with image. Like it doesn’t load a css but more terrible

    Reply
    • Mastery Websites

      Oxygen by default is a blank slate. It starts with a blank screen.

      Reply
  8. xifre

    I will definetly give this a try. I didn’t really want to create a staging site. Thanks a lot, and congrats for the great content and for keeping the code up to date!

    Reply
    • Mastery Websites

      Ok, pls respond with how it went.

      Reply
  9. Ian

    I am having issues, the code works perfectly but the problem is that by including pluggable.php it hooks wp_mail which in turn causes problems with Fluent SMTP / Postman SMTP.

    Do you have any idea how to fix it?

    The idea is awesome, I just need a solution for that.

    Reply
    • Mastery Websites

      Hi Ian, thanks for your feedback. Do you see any error displaying ?

      Reply
      • Ian Katz

        The FluentSMTP plugin depends on wp_mail pluggable function and plugin is not able to extend it. Please check if another plugin is using this and disable it for FluentSMTP to work!

        Possible Conflict: F:\laragon\www\wp-includes\pluggable.php:182

        It happens both on Localhost and on a live website (which is the one I want to edit).

        I changed the If condition to (if ($current_user->ID == 475) but this also happens if I just use the code exactly as you posted it.

        Reply
        • Mastery Websites

          Looks like this is a known issue: https://github.com/WPManageNinja/fluent-smtp/issues/10

          I can recommend trying another SMTP plugin. I usually use WP MAIL SMTP BY WPFORMS (im not sure if it uses pluggable, but it has a good reputation generally). And there are many others you can try. I think it is worth the effort – in order to get it all to work.

          Reply
          • Ian

            That worked. I thought no other SMTP plugins would work, since I had also tried Postman SMTP and it gave me the same error.

            It works great and it’s very useful, thank you!

          • Mastery Websites

            Great! I’m happy you got it to work.

  10. Aleksandra

    Sadly, it didn´t work for my page. I will try again.

    Reply
    • aleksandra

      OK. Now it worked! Many thanks!

      Reply
      • Mastery Websites

        Great! Thanks for your feedback.

        Reply
  11. probowie

    Just wanted to comment about how valuable this is to anyone with an existing site that want’s to make changes non-destructively! I modified to filter for just me: if (is_user_logged_in() && get_current_user_id() === 1) and it works wonderful!

    This should be part of the Oxygen Builder suite so newbies can use it. Reach out to them and maybe they will expand upon this in their code to make it easier for everyone switching.

    Thanks again!!

    Reply
    • Mastery Websites

      Thanks for your feedback and also your suggested modified code.

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *