Support » Plugin: WordPress HTTPS (SSL) » [Plugin: WordPress HTTPS] Disable https:// for menu links

  • Resolved epschmidt


    I’m using the https for wordpress plugin to force SSL on our WP E-commerce checkout page. Everything is working so I don’t get any errors, but it also forces our menu’s to be https, when they should link back to just regular http pages. Is there a way to alter the plugin to not affect these links? Or another way to make sure they stay http?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Mike Ems


    Unfortunately, that is how the plugin works. The functionality of this plugin was added in WordPress 3.0, which is kind of annoying. If you have a version lower than 3.0, however, you can use my plugin, WordPress HTTPS, to fix your unencrypted elements. My plugin does not touch anchor tags. If you have 3.0, your links are going to be changed to HTTPS when any of your pages are viewed via HTTPS. I’m not sure if there is a way to disable this functionality, but maybe someone else knows?

    Wow after an hour of searching I think I finally found something useful…

    WordPress Version: 3.0.1
    Core File: wp-includes/link-template.php
    Lines: 1840-1872 (for me at least)

     * Retrieve the home url for a given site.
     * Returns the 'home' option with the appropriate protocol,  'https' if
     * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is
     * overridden.
     * @package WordPress
     * @since 3.0.0
     * @param  int $blog_id   (optional) Blog ID. Defaults to current blog.
     * @param  string $path   (optional) Path relative to the home url.
     * @param  string $scheme (optional) Scheme to give the home url context. Currently 'http','https'
     * @return string Home url link with optional path appended.
    function get_home_url( $blog_id = null, $path = '', $scheme = null ) {
    	$orig_scheme = $scheme;
    	if ( !in_array( $scheme, array( 'http', 'https' ) ) )
    		$scheme = is_ssl() && !is_admin() ? 'https' : 'http';
    	if ( empty( $blog_id ) || !is_multisite() )
    		$home = get_option( 'home' );
    		$home = get_blog_option( $blog_id, 'home' );
    	$url = str_replace( 'http://', "$scheme://", $home );
    	if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false )
    		$url .= '/' . ltrim( $path, '/' );
    	return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id );

    I don’t know what the hell I’m doing really… but I just changed the following:

    $scheme = is_ssl() && !is_admin() ? 'https' : 'http';


    $scheme = is_ssl() && !is_admin() ? 'http' : 'http';

    And it seemed to revert back to the standard behavior… I’m more than sure there is a better way to work around this… maybe using some sort of filter in functions.php… I’m just not at all sure where to start with something like that.

    Plugin Author Mike Ems


    Hey idliketofly,

    I have figured out how to disable this functionality in WordPress 3.0+.

    I have added the option to WordPress HTTPS v1.0.

    Let me know if it works for you!

    Hey Mvied,

    Nope… not working for me.

    I reverted the change to link-template.php I posted above and uploaded, verified the automatic https links had indeed returned, updated your plugin, selected “Disable Automatic HTTPS”, and saved. When I view any https page on my site, all the post and page links are still https.

    If I make the change to link-template.php again, all the links revert to standard HTTP.

    WordPress 3.0.1.
    WordPress HTTPS 1.0.1

    Plugin Author Mike Ems


    I have a feeling your theme may be using a function that I’m not filtering to build your links.

    I had it working on a fresh install of WordPress 3.0.1 using the TwentyTen theme.

    Could you do two things for me?
    1. Change your sites theme to TwentyTen and tell me if the links are fixed in that theme.
    2. Post the code from your template that is generating the links that are not changing (even if it’s just a standard WordPress function).


    I can’t switch themes, but it’s not likely something in my theme …or at least not anything “odd”. My functions.php for this theme is pretty sparse, containing only one function: “remove_dashboard_widgets()”, which pulls specified metaboxes off the admin dashboard and doesn’t have any affect on the user-facing portion of the site.

    As for the code that was generating the links that wouldn’t respond to your plugin… I think I’ve got it narrowed down to any link containing “<?php bloginfo(‘url’); ?>”. Hard coded links that use the static url (e.g. work as expected.

    I just updated this site to 3.0 last week, so to test this issue further, I implemented the new “menu” system, and Bob’s your uncle… your plugin started working for the main navigation as well.

    So as far as I can tell, any hard coded link that contains “<?php bloginfo(‘url’); ?>”, still points to https.

    Plugin Author Mike Ems


    Ah, that makes sense.

    Well, that function and all of the URL’s it delivers probably need to be filtered as well. I’ll get it into the next update.

    Thanks! I’ll keep an eye out for an update and report back anything new.

    Plugin Author Mike Ems


    I just pushed version 1.5 to the repository. It will now fix URL’s that use the bloginfo function.

    Also, I’ve added the ability to force certain pages to HTTPS. Additionally, there is an option to force all pages not forced to HTTPS back to HTTP. This should be quite useful to those of you who only need a single page or so forced to HTTPS.

    I have a page that I need forced to be https:
    I have checked “Force SSL Exclusively” on this page.

    But it is also a link on two menus on all pages (sidebar and top navigation). So if I check “Disable Automatic HTTPS” then the links to the Registration Form are now http.

    Any way around this ??

    Plugin Author Mike Ems


    No, this is working as intended. When clicked, the page will be redirected to HTTPS, and the end-user probably won’t even notice.

    However, on your site, you seem to have a plugin interfering with the redirection. Try turning off plugins one-by-one until you can go to and you are properly redirected to HTTPS. After that, let me know which one it is and I’ll see if I can fix the incompatibility for you.


    OK – thanks for the quick reply.

    Will do that tonight and let you know how it goes

    Plugin Author Mike Ems


    Hey Auntypizza,

    Any updates? I’m quite curious to know which plugin is incompatible with mine, as this is the first time I’ve seen it happen.


Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Plugin: WordPress HTTPS] Disable https:// for menu links’ is closed to new replies.