WordPress.org

Ready to get started?Download WordPress

Forums

WordPress HTTPS (SSL)
force_ssl on ALL pages? (2 posts)

  1. GenoGod
    Member
    Posted 2 years ago #

    I've found this code on the FAQ page but there wasn't much information.

    function custom_force_ssl( $force_ssl, $post_id ) {
        if ( $post_id == 5 ) {
            return true
        }
        return $force_ssl;
    }
    add_filter('force_ssl' , 'custom_force_ssl', 10, 2);

    I'm not great at PHP but from what I can tell, that's just to secure one page.

    So instead I added

    force_ssl == true;

    to the header.php file in my theme folder but it still seems it isn't catching.

    What am I missing?

    Secure site: https://floridaga.net
    Insecure page: http://floridaga.net/members/occupyflorida/

    How the heck do I lock down the entire site??

    http://wordpress.org/extend/plugins/wordpress-https/

  2. Mvied
    Member
    Plugin Author

    Posted 2 years ago #

    Hey GenoGod,

    So you put this?

    function custom_force_ssl( $force_ssl, $post_id ) {
        if ( $force_ssl == true ) {
            return true
        }
        return $force_ssl;
    }
    add_filter('force_ssl' , 'custom_force_ssl', 10, 2);

    If so, that won't do anything except return true when $force_ssl is already true.

    You would use this to make every page Force SSL:

    function custom_force_ssl( $force_ssl, $post_id ) {
        $force_ssl = true;
        return $force_ssl;
    }
    add_filter('force_ssl' , 'custom_force_ssl', 10, 2);

    You place that code block in the functions.php of your theme. If it doesn't exist, create it. Using this code is essentially the same as setting your whole site to HTTPS. You may want to consider doing that instead.

    Thanks,
    Mike

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic