Many WordPress themes now integrate the Baidu Share component. However, Baidu Share currently does not support HTTPS access (which is truly frustrating—Baidu promotes and advocates HTTPS adoption, yet its own product is not properly implemented). As a result, many webmasters who have enabled HTTPS cannot use Baidu Share normally. After some searching, I found a way to solve the problem of Baidu Share not supporting HTTPS, which I will share with you below.

Project URL

https://github.com/hrwhisper/baiduShare

Usage

  1. Download the archive, place it in the website root directory, and extract it (make sure the static directory is directly under the root directory after extraction, rather than in a secondary directory). Download link: https://github.com/hrwhisper/baiduShare/archive/master.zip
  2. Modify the corresponding Baidu Share code by replacing the URL http://bdimg.share.baidu.com/ with / (a single slash only).

For example, change the code:

.src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];

to:

.src='/static/api/js/share.js?v=89860593.js?';

This completely solves the problem of Baidu Share not supporting HTTPS!