Support » Plugin: WordPress HTTPS (SSL) » [Plugin: WordPress HTTPS (SSL)] Filter based on URL doesn't work

  • I’m having trouble using the filter you provided to filter pages based on url. I’m trying to secure this donation page: and am trying to secure some php and css files through a url based approach but I’m getting an error. I for now removed the code from my functions file to not interrupt the site.

    I was wondering if you can “secure” specific files or all files in a specific folder or how to fix the filter based on url so i don’t get the error message anymore.


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


    The filter is for filter your WordPress pages, nothing else. It doesn’t filter files on your page.

    What are you trying to fix? What is wrong? What error do you get?

    Thanks for the fast reply. This is the error I’m getting:
    Warning: Missing argument 2 for donation_force_ssl() in /..[path]…../functions.php on line 142
    (line 142 = first line of the code below function….)

    This is how I customized the code for this site:

    function donation_force_ssl( $force_ssl, $post_id ) {
        if ( strpos($_SERVER['REQUEST_URI'], 'xy') !== false ) {
            $force_ssl = true;
        return $force_ssl;
    add_filter('force_ssl', 'donation_force_ssl');

    “xy” is the folder as well as url path of the files, that I want to protect.

    Is there a way to add code to a php file I want to secure other than the functions file?

    Plugin Author Mike Ems


    To fix that error, just change add_filter('force_ssl', 'donation_force_ssl'); to add_filter('force_ssl', 'donation_force_ssl', 10, 2);.

    No, the plugin is for WordPress, so if you’re not going to a WordPress page, you can’t use the plugin.

    Thanks I’ll try that. And yes I’m using the plugin on WordPress of course.

    Plugin Author Mike Ems


    Alrighty. Saying you want to secure a folder of files doesn’t really sound like WordPress.

    You could literally put the filter in any file in your theme, but there’s no reason to. For themes, that’s where you put filters and hooks. If you want to take that filter and make it its own plugin, you can do that too. Here’s an example of one I wrote for someone.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: WordPress HTTPS (SSL)] Filter based on URL doesn't work’ is closed to new replies.