Click here to Skip to main content
11,930,069 members (51,444 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as



Fixing protocol errors in WordPress plugins

, 8 Oct 2013 GPL3
Rate this:
Please Sign up or sign in to vote.
Fixing protocol errors in WordPress plugins.

I recently started a new job as a full-time WordPress developer managing several websites and the myriad of custom themes, child themes, and plugins. This is a lesson learned from an issue I had with one plugin in particular.

Using Chrome on OS X, I get security warnings that a script wouldn’t load on a particular page. When I looked into it, I found it was because in wp-admin, my site URL is set to http, but that page (and several others) is served from https. Since there’s a mix of protocols, good browsers will block scripts from running across SSL/non-SSL.

The plugin was using get_options('siteurl') to create the path string used to load scripts through wp_register_scripts. Switching to site_url(), which returns a string with the protocol that the page is being rendered on, let's me now safely load the scripts on any page in the site.

Here’s how it ended up looking:

$old_root_url = get_options( 'siteurl' );
$root_url = site_url();

$path_flash = "$root_url/wp-content/plugins/$pluginName/js/swfobject.js";

Hope that helps someone!


This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


About the Author

Morgan Estes
Web Developer Golf Tailor LLC
United States United States

I build websites.

I like to build things, especially using WordPress.

I'm happy working in PHP, JS, HTML, CSS, and a bunch of other acronyms, but I'm happiest when I find a way to put the pieces together to create something useful.

You can see more of my work at

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.151126.1 | Last Updated 8 Oct 2013
Article Copyright 2013 by Morgan Estes
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid