【问题标题】:Is there a way to force images on the "metaslider" plugin to to load using HTTPS instead of the default HTTP有没有办法强制“metaslider”插件上的图像使用 HTTPS 而不是默认的 HTTP 加载
【发布时间】:2014-06-10 10:56:08
【问题描述】:

我正在使用 Metaslider wordpress 插件 http://wordpress.org/plugins/ml-slider/ 并且我已经安装了 SSL 证书。但是幻灯片所在的页面告诉我页面上有一些不安全的元素。这些元素是幻灯片中默认使用 HTTP 加载的图像。有没有办法强制他们使用 HTTPS 加载?

【问题讨论】:

    标签: wordpress plugins https


    【解决方案1】:

    只需在设置 > 常规中将默认地址更改为 http://。强制 https 的 Wordpress 插件不适用于 metaslider

    【讨论】:

      【解决方案2】:

      您可以在该特定页面上运行类似这样的某种功能。

      在你的functions.php中

      <?php
      function filter_content_match_protocols( $content ) {
          $search = $replace = get_bloginfo( 'home' );
      
          if ( ! preg_match( '|/$|', $search ) )
              $search = $replace = "$search/";
      
          if ( is_ssl() ) {
              $search = str_replace( 'https://', 'http://', $search );
              $replace = str_replace( 'http://', 'https://', $replace );
          }
          else {
              $search = str_replace( 'http://', 'https://', $search );
              $replace = str_replace( 'https://', 'http://', $replace );
          }
      
          $content = str_replace( $search, $replace, $content );
      
          return $content;
      }
      ob_start( 'filter_content_match_protocols' );
      
      function filter_content_match_protocols_end() {
          ob_end_flush();
      }
      add_action( 'shutdown', 'filter_content_match_protocols_end', -10 );
      ?>
      

      【讨论】:

        猜你喜欢
        • 2017-10-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-07-04
        • 2015-08-15
        • 2011-01-17
        • 2019-11-02
        • 1970-01-01
        相关资源
        最近更新 更多