WordPress HTTPS (SSL)
Filter based on URL doesn't work (6 posts)

  1. GreenDiablo
    Posted 3 years ago #

    I'm having trouble using the filter you provided to filter pages based on url. I'm trying to secure this donation page: https://abyfund.org/donate/ and am trying to secure some authorize.net 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.



  2. Mike Ems
    Plugin Author

    Posted 3 years ago #

    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?

  3. GreenDiablo
    Posted 3 years ago #

    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?

  4. Mike Ems
    Plugin Author

    Posted 3 years ago #

    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.

  5. GreenDiablo
    Posted 3 years ago #

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

  6. Mike Ems
    Plugin Author

    Posted 3 years ago #

    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. http://pastebin.com/nYugCVjf

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress HTTPS (SSL)
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic