Tag Archives: Mutliple WordPress sites

How to open WordPress admin panel in iframe?

How to open wp-admin in iframe?Hello everybody,

You want to put WordPress in iframe? Sure, no problem. Now, are You trying to log in to wp-admin from iframe? Not possible? Here is the simple solution how to fix opening wp-admin in iframe.

How to open wp-admin in iframe?

Open this file in Your editor:

/YOUR_WORDPRESS_INSTALLATION/wp-includes/default-filters.php

Find and comment out this two lines:

add_action('login_init', 'send_frame_options_header', 10, 0);
add_action('admin_init', 'send_frame_options_header', 10, 0);

 

Background story of wp-admin in iframe problem

What problems we encountered? We had to create solution, that can manage multiple WordPress instances from one admin panel. The problem was, that all websites was on different servers, separate databases etc. So mutlisite is not an option here.

I did small research and found some good wordpress plugins that helps manage multiple wordpress instances:

All of them are really great solutions if You need quick and ready solution.

Both WP-Remote and ManageWP are based on admin panel that creators of these services provides. So You don't have to install anything on Your server. Just create an account on one of them, add Your websites and that's it. Really simple, but unfortunately due to some restrictions in the company I work it was impossible to use one of these solutions. We wanted to be able to change the logo, restyle the admin panels etc. And if we will need any additional functionality that these two solutions provides we will be screwed.

Third solution - InfiniteWP seemed to be best option. You can install it on Your server, you have access to source code, You are able to modify almost anything. I installed it on my localhost and have already some problems.

InifniteWP works like this: You install small plugin on the WordPress website You want to connect with InfiniteWP. It provides You connection data, some secret key etc. When I was trying to add one of the websites I was waiting and waiting and then BUM! Connection was reset. There was nothing in log files, I didn't get any errors and anything. So when I run it with error_reporting(E_ALL) - OMG. Hundreds of warnings etc. After two days of debugging finally I was able to add websites to the InfiniteWP. It works really great on local machine. Clients was satisfied when I showed them the solution via conference room and screen sharing.

More problems started when we putted it on our test server. First of all it worked sooooo slow. After adding website indicator was spinning like forever. All requests took about 5-20s to finish. I fought with that for another 2 days and there was nothing I could really do about it. Googling, reinstalling etc. Nothing!

My approach of dealing with wp-admin in iframe

When I was showing our clients InfiniteWP on my local machine they was quite happy, most of because I was able to run multiple websites without logging in to each website separately. They was able to switch between the websites. InfiniteWP is working kind of a windows with the taskbar where You can switch between applications.

So I thought, we not to create some really simple solution, when I will open WordPress in iframe? Simple switching on JavaScript between iframes. They was quite happy about this, as writing this solution took only 1 day. Fast and simple. The only problem was how to enable opening wordpress admin panel in iframe? But you know the solution already, don't you?:)

Our services: