Improving for iframe load times for WordPress Calls to Action

Post written by Hudson Atwell
On Monday, January 20th, 2014

The Problem

WordPress Calls to Action currently loads CTAs in iframes which can cause a delayed load of the content in the iframe.

Even with caching enabled we call a redirect script that programatically disables caching so we can display the correct variation in a split testing scenario, which means that if you have a lot of plugins activated we could see delayed displays of up to 2-5 seconds.

The Improvement

Since CTAs are basically their own custom post type being loaded within an iframe we wanted a way to disabled plugins that are not related to the CTA plugin or any other plugin that the CTA might be dependant on related to our toolsets over at

The Solution

WordPress has a hook called ‘option_active_plugins’ that can be accessed by plugin in the /wp-content/mu-plugins directory.

mu-plugins (must use plugins) are php files pasted directly into the /mu-plugins/ directory. They do not need their own subdirectory as they are usually meant to be single files. They also to not need to be activated or deactivated as having them in the mu-plugins directory will immediately activate them.

We wrote a mu-plugin that will disable all non-inboundnow plugins when loading a CTA in an iframe.

Installing the code below in the /mu-plugins/ directory will dramatically improves the load time of pages called with the _GET parameter.

The Code

Plugin Name: Calls to Action - CTA Load Time Enhancement
Plugin URI:
Description: Disabled 3rd party plugins and themes in order to speed up CTA iframe render times. 
Version: 1.3.0
Author: Hudson Atwell
Author URI:

$current_url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."";

/* Listener for Thin Load */
if ( strstr( $current_url , '/cta/' ) )
	add_filter( 'option_active_plugins', 'wp_cta_thin_disable_plugin' );
	function wp_cta_thin_disable_plugin($plugins)
		$whitelist = array('cta/wordpress-cta.php','landing-pages/landing-pages.php','leads/wordpress-leads.php','marketing-automation/marketing-automation.php');

		foreach ($plugins as $name)
			if ( in_array( $name , $whitelist) || strstr( $name , 'inboundnow-' ) )
				$whitelist_plugins[] = $name;


		return $whitelist_plugins;

About the Author:
Cheers! Hudson Atwell is a co-founder and current administrator of Inbound Now. Consider hiring him through the Agency or connecting with him professionally through LinkedIn.

Signup and get started with Inbound Now

Sign Up for Free


[gravityform id="3" name="Popup Form" title="false" description="false" ajax="true"]