Support » Plugin: WP Stripe » Conflict with https/ssl and WP_PLUGIN_URL

  • Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    Per – the old constants don’t work with SSL.

    To make this work on an SSL site, I had to add in this:

    if (isset($_SERVER['HTTPS'])) {
            define( 'WP_PLUGIN_URL', 'https://'.$_SERVER['HTTP_HOST'].'/wp-content/plugins' );

    Would it be possible to change the call to WP_PLUGIN_URL to plugin_dir_url() instead?

    The code is here:

    define ( 'WP_STRIPE_PATH', WP_PLUGIN_URL . '/' . end( explode( DIRECTORY_SEPARATOR, dirname( __FILE__ ) ) ) );

    would become:

    define ( 'WP_STRIPE_PATH', plugin_dir_url() );

    (plugin_dir_url() calls plugin_url(), but since you just want the URL of the plugin, and not a sub file, plugin_dir_url() seemed more appropriate. If you were calling subfiles, like for jquery, it’d be plugins_url( 'js/fartscroll.js' , __FILE__ ) instead – and I know Noel already knows this, but now people reading do too! 😉 )

  • The topic ‘Conflict with https/ssl and WP_PLUGIN_URL’ is closed to new replies.