WP Weixin provides integration between WordPress and WeChat. Register or authenticate users automatically in WeChat browser, use WeChat to create an account or authenticate on computers by scanning a QR code with WeChat, share posts in WeChat Moments and conversations or extend the plugin for more features!
- Requires a China Mainland WeChat Official Account (Subscription or Service – Service is required if used with companion plugins dealing with payments).
- A domain used by WordPress must be registered in an Official Account’s backend.
- The plugin itself does not require programming knowledge, and provides really useful functionalities out of the box. Where it really shines though is when used by developers to extend its functionalities (mainly through the pre-initialised JS SDK, the WeChat Responder, and various provided functions, actions and filters).
- Make sure to read the “TROUBLESHOOT, FEATURE REQUESTS AND 3RD PARTY INTEGRATION” section below and the full documentation before contacting the author.
This plugin adds the following major features to WordPress:
- WP Weixin settings page: configure the plugin with an Official Account (or as many as you want in multisite) in English or Chinese out of the box, with instructions for each option.
- WeChat Authentication: automatically create and authenticate users in WordPress in the WeChat browser, or allow users to scan a QR code with WeChat when using classic browsers (social login).
- WeChat Account Binding: let users bind/unbind their existing WordPress account with their WeChat account. Integrated with WooCommerce and Ultimate Member account pages, and may be integrated with any membership/account/profile plugin easily.
- Force WeChat mobile: to prevent users from browsing the website outside of the WeChat browser. If accessed with a classic browser, the page displays a QR code.
- Force following the Official Account: to harvest WeChat followers, forcing users to follow the Official Account before accessing the content.
- WordPress Users screen override: to display WeChat names and WeChat avatars if they exist, instead of the default values in the user screen.
- WP Weixin QR code generator: to create custom codes.
- Menu integration: allows to set the Official Account menus in WordPress when the WeChat Responder is enabled.
- Welcome message: sends a welcome message in WeChat when a user follows the Official Account ; allows to do so with WordPress when the WeChat Responder is enabled.
- Developers – WeChat Responder: for developers to receive and respond to calls made by WeChat’s API.
- Developers – WeChat JS_SDK: the
- Woo WeChatPay: a payment gateway for WooCommerce.
- WP Weixin Pay: an extension to enable money transfers to an Official Account.
- WP Weixin Broadcast: broadcast WordPress posts to WeChat followers, directly from WordPress
Developers are encouraged to build plugins and themes integrated with WeChat with WP Weixin as a core, leveraging its publicly available functions, actions and filters, or directly make use of the provided SDK.
If you wish to see your plugin added to this list, please contact the author.
Advanced – Multisite
WP Weixin supports multisite installs of WordPress, wether using domain/subdomains or subdirectories. It can even support multiple Official Accounts, provided the proper filters are implemented. For more information, see a more extensive description of the multisite settings, and the Multisite section of the documentation.
Unlike some plugins (commercial, obfuscated, and with dubious security standards), WP Weixin does not and will not rely on a crossdomain script dumped at the root of WordPress, but prefers to leverage the standard WordPress functions, actions and filters.
Troubleshoot, feature requests and 3rd party integration
Unlike most WeChat integration plugins, WP Weixin and its companion plugins published by the same author are provided for free.
WP Weixin is regularly updated, and bug reports are welcome, preferably on Github. Each bug report will be addressed in a timely manner, but issues reported on WordPress may take significantly longer to receive a response.
WP Weixin and all the companion plugins have been tested with the latest version of WordPress – in case of issue, please ensure you are able to reproduce it with a default installation of WordPress, Storefront theme if WooCommerce is active, and any of the aforementioned supported plugins if used before reporting a bug.
Feature requests (such as “it would be nice to have XYZ”) or 3rd party integration requests (such as “it is not working with XYZ plugin” or “it is not working with my theme”) for WP Weixin and all its companion plugins will be considered only after receiving a red envelope (红包) of a minimum RMB 500 on WeChat (guarantee of best effort, no guarantee of result).
To add the author on WeChat, click here, scan the WeChat QR code, and add “WP Weixin” as a comment in your contact request.
This section describes how to install the plugin and get it working.
- Upload the plugin files to the
/wp-content/plugins/wp-weixindirectory, or install the plugin through the WordPress plugins screen directly.
- Activate the plugin through the ‘Plugins’ screen in WordPress
- Edit plugin settings
Contributors & Developers
“WP Weixin” is open source software. The following people have contributed to this plugin.Contributors
'wp_login'action when automatically logging in with the WeChat browser
- Make sure not to show frontend error on default login page
- Support JS-SDK
- WordPress tested up to: 5.4.1
- Update interface strings – payment callback labels
- WC tested up to: 4.0.0
- Translation updates
- WC tested up to: 3.9.2
- Fix a critical issue when enabling proxy (special thanks to @zhoufann9188 on GitHub)
- Enhance template selection method
- WC tested up to: 3.9.1
- Minor bugfix: WeChat Responder should not be responding to button click event
- Minor bugfix: Change a call to
- WeChat SDK: Update MASS_GET const – call https
- Minor bugfix: WeChat Responder settings validation
- WeChat SDK: Update error codes and descriptions
- WC tested up to: 3.9.0
- WeChat SDK: Update error codes and descriptions
- WeChat SDK: Add Broadcast methods (
- WeChat SDK: Add mobile browser H5 unified order method (
- WeChat SDK: refactor asset management methods
- WeChat SDK: refactor WeChat response parsing
- WeChat SDK: convert encryption calls with mcrypt to open_ssl
- WeChat SDK: response to erquests coming from WeChat handled using Customer Service interface instead of passive response
- WeChat SDK: removed “event” ; added “voice”, “mpnews”, “video” and “menu” message types
- Settings: decrease coupling with companion plugins
- Added plugin version headers for companion plugins to check compatibility
wp_weixin_ajax_safe()function to allow WP Weixin to run during specific ajax requests
- Added filter hook
wp_weixin_ecommerce_descriptionto allow extensions to customise the WeChat Pay Settings description.
- Added check to output logs only when WordPress debug is activated
- Added a notice on WooCommerce account edit page: WeChat registered users have an auto-generated password and it should be changed using the “Lost your password?” link in a web browser.
- Added a template to tell users how to change their password when their account has been created automatically after they visited the site with WeChat browser.
- Added a metabox to override the title and description of WeChat links when sharing a post on WeChat.
- Use user meta to save follower status and react to events using the responder instead of relying on transient and cookies.
- Display the featured image of the post in previously visited if exists instead of default image when following with force follow
- Attempt to solve Multisite authentication issues
- Minor bugfixes
- Version 1.3.3 and 1.3.4 skipped
- Update documentation
- Add server logs when user creation failed
current_time( 'timestamp' )by
time()as per WordPress trac ticket
- Update requirements
- Major overall code refactor
- File include optimisation
- Do authentication in
wp(breaks multisite if done in
- Add WeChat account binding from desktop, compatible WooCommerce and Ultimate Member out of the box ; may be integrated with any membership/account/profile plugin using provided functions and action & filter hooks
- Add links to WeChat authentication in classic browsers on login forms, compatible WooCommerce and Ultimate Member out of the box ; may be integrated with any membership/account/profile plugin using provided functions and action & filter hooks
- Add 11 new publicly available functions safe to use for developers
- Add 26 action hooks for integration with the WP Weixin settings page, integration with membership/account/profile plugins, better integration with WeChat Pay, and build companion plugins
- Add 8 filter hooks for better integration with WeChat Pay, customise the settings, manage users, and overload templates
- Add 3 templates related to WeChat account binding
- Support query variables in the URLs while doing authentication
- Sensitive information in settings visible only when field is focused
- SDK: add
refundOrder– if string, value is attributed to
- Improve the UI
- Update documentation – added “WeChat SDK” section, “Multisite” section, new functions and new hooks
- Update translation
- Thanks @alexlii for extensive testing, translation, suggestions and donation!
- Thanks @lssdo for translation
- Thanks @kzgzs for improvement suggestions
- Fixed bug redirecting to posts list after first authentication
- Do authentication in
- WeChat Pay Settings: add PEM certificates fields
- WeChat SDK: add
public function cert_files_exist()
- WeChat SDK: fix refund method
- WeChat SDK: fix payment request parsing method
- Update documentation
- Better error log
- Fix persistent cache handling
- Optimized rewrite rules registration
- Multisite support with cross-domain authentication
- Fix unnecessary redirect when visiting QR code auth the first time
- Better compatibility with WPML and WooCommerce
- Better compatibility with Open Social
- Adjust hooks priorities and condition for authentication hooks registration
- Do not require mobile authentication for ajax calls by default (can be altered with wp_weixin_auth_needed filter hook)
- Proper 401 error if the server signature is not valid when visiting the WeChat Responder endpoint
- Fix menu integration – make sure all types of button can be configured
- Make sure authentication hooks registration is done only when necessary
- WeChat SDK: fix media upload methods
- WeChat SDK: add image response type
- Add WeChat authentication for browsers by using temporary, secure QR codes (social login)
- Cleanup and minor refactor
- Added 2 functions, 4 filters, 3 templates
- Add transient expiry to avoid deadlocks on somehow corrupted databases
- Add possibility to get WordPress users by openid and unionid
- Ensure compatibility with Open Social
- Improve formatting
- Adjust hooks priorities
- Add Chinese translation
- Fix activation settings issue
- First version