1

I am attempting to troubleshoot the install path showing up in Plugins.php for a plug-in I have installed on my site that I did not originally write. All resources referenced and installed by this plug-in come up as mixed content HTTP when the rest of my site is HTTPS.

I have been playing around with the code segment below but it doesn't seem to be making a difference and resolving the issue. Can someone point out what I am missing?

    /**
     * registers scripts and stylesheets
     */
    public function register_assets() {
        $theme = strtolower( get_option( 'wp-plugintheme', 'default') );

        // scripts
        wp_register_script( 'wpa-functions', plugins_url() . 'resources/scripts/wpa-functions.js' );
        wp_register_script( 'wpa-custom', WPA_PLUGIN_URL . 'resources/scripts/wpa-custom.js' );
    }

I know the edits I am making are taking affect as well as I have been able to add extra \ s to the path.

    /**
     * Creates plugin globals and manages version number
     */
    public function setup() {
        // define global variables
        if (!defined('WPA_THEME_DIR') )
            define('WPA_THEME_DIR', ABSPATH . 'wp-content/themes/' . get_template() );

        if (!defined('WPA_PLUGIN_NAME') )
            define('WPA_PLUGIN_NAME', trim(dirname(plugin_basename(__FILE__) ), '/') );

        if (!defined('WPA_PLUGIN_DIR') )
            define('WPA_PLUGIN_DIR', WP_PLUGIN_DIR . WPA_PLUGIN_NAME . '/');

        if (!defined('WPA_PLUGIN_URL') )
            define('WPA_PLUGIN_URL', WP_PLUGIN_DIR . WPA_PLUGIN_NAME . '/');

        if (!defined('WPA_PLUGIN_BASENAME') )
            define('WPA_PLUGIN_BASENAME', plugin_basename(__FILE__) );

But I still continue to get these: Blocked loading mixed active content http://website.org/wp-content/plugins/wp-plugintheme/resources/scripts/wpa-functions.js?ver=4.0.1

Any help or thoughts as to what I can do short of Forcing SSL just for this one plug-in?

  • Have you tried to just put in the full secure url? Ex: wp_register_script( 'wpa-functions','https://website.org/wp-content/plugins/wp-plugintheme/resources/scripts/wpa-functions.js?ver=4.0.1'); – user42826 Nov 25 '14 at 1:22
  • I did try that but it only address some of them and really hoping to find the non-hard coding paths solution. – CRSouser Nov 25 '14 at 1:37
0

The root of my problem was none of the above and it was a change in the way Wordpress internal variables worked.

The plug-in I was attempting to troubleshoot was utilizing the following:

define('WPA_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . WPA_PLUGIN_NAME);
define('WPA_PLUGIN_URL', WP_PLUGIN_URL . '/' . WPA_PLUGIN_NAME);

New Code which per these two links stating to do not use the internal Wordpress variables and to use these instead took care of it in the primary plugin PHP file.

define('WPA_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
define('WPA_PLUGIN_URL', plugin_dir_url( __FILE__ ));

Checking the Wordpress codex was what I needed to do to determine methods were being used and the forums were helpful. I since found several plugins I previously stopped using due to SSL issues were doing something similar.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.