The WP Discourse plugin acts as an interface between your WordPress site and your
Use Discourse for comments:
- Automatically creates a forum topic for discussion when a new blog post is published.
- Associates WP author accounts with their respective Discourse accounts. Does not require DiscourseConnect.
- Replies from the forum discussion can be embedded in the WP blog post. Select which replies to display
based on post score and commenter “trust level” — see docs.
See it live
The plugin also comes with optional DiscourseConnect functionality which lets you use your WordPress site as the
DiscourseConnect provider for your Discourse forum.
This will override Discourse’s native (and powerful) login flow and is only recommended for use cases
that strictly require such a setup, e.g. a site that is already using WordPress for large scale user management.
Authentication from Discourse to WordPress
The plugin allows you to use Discourse as an authentication provider for your WordPress site.
The WP Discourse plugin requires PHP version 5.4.0 and greater. If >=PHP-5.4.0 is not available, the plugin installation
This plugin provides 1 block.
- Discourse Comments Shows replies in Discourse as comments in Wordpress.
From your WordPress dashboard
- Visit ‘Plugins > Add New’
- Search for ‘WP Discourse’
- Activate WP Discourse from your Plugins page
- Download WP Discourse
- Upload the ‘wp-discourse’ directory to your ‘/wp-content/plugins/’ directory
- Activate WP Discourse from your Plugins page
Does it work with a WordPress multisite configuration?
All of the plugin’s functionality except for using Discourse as the DiscourseConnect provider for WordPress works with multisite configurations.
Does this plugin install Discourse for me?
No this plugin acts as an interface between Discourse and WordPress. For it to work you will need to first set up
Discourse forum. You can install Discourse for yourself following either of these guides:
Can I import old WordPress comments as Discourse comments (i.e. “replies”)?
Do WordPress and Discourse have to be installed on the same server?
The plugin uses the Discourse API, so your forum and blog can be hosted separately and the integration will still work.
In fact, we strongly recommend hosting the two applications separately, since their hosting requirements are very different.
Is it possible to customize the comment templates?
Yes, the html templates used for publishing posts on Discourse and for displaying comments on WordPress can be customized in your theme.
This is done by hooking into the filters that are applied to each template.
Can my Discourse theme inherit the styling of my WordPress theme?
Not automatically. You need to apply custom HTML&CSS to Discourse in order to match the theme of your WordPress site.
To create a coherent top menu, see our tutorial on how to make a Custom nav header
Contributors & Developers
“WP Discourse” is open source software. The following people have contributed to this plugin.Contributors
- Fix optional parameter handling in get_discourse_comments.
- Fix compatibility with S3 uploads plugin.
- Fix usage of get_the_excerpt filter.
- Fixed HTML of avatars in quotes in comments.
- Verified backwards compatibility for WP > 5.1
- Improve logs metafile handling.
- Add logs enabled setting.
- Adds Discourse Comments block for the Block Editor.
- Improvements to the functionality and interface of the get_discourse_comments utility function.
- Adds wpdc_after_webhook_post_update action for use with caching solutions.
- Fix logout when WP is the DiscourseConnect client and sync logout is enabled.
- Improve the wpdc_publish_body filter.
- Add after_publication actions and logging
- WordPress 6.0 support
- Granular API Key support (backwards compatible)
- DiscourseConnect copy fix
- Add wpdc_publish_body filter
- Temporarily remove comment formatter log call causing issues on some sites.
- If comments are disabled return comment template without running comment formatter.
- Update Github Actions to support Action changes
- Bugfix “Update Discourse Topic” functionality.
- Update API Key copy.
- Revert to existing Discourse Username approach.
- Move new Discourse Username support to publication setting.
- Apply phpcs to unit tests.
- Add proper Discourse Username support
- Ensure discourse_request method is uppercase.
- Update tests config.
- Add WordPress 5.9 support.
- Complete wp_remote_request standardisation.
- Add method checks to all request tests.
- Update CI and developer documentation
- Fix wrong verb being used in
- Structural code improvements
- Add logging to connection, comments, webhooks and DiscourseConnect
- Add unit tests to connection, comments, webhooks, DiscourseConnect and multisite
- Improve comment HTML tag sanitization
- Update Discourse API key help text
- Add translation pipeline for configurable text
- Support WPML in translation pipeline for configurable text
- Adopt Discourse approach to tag cleaning, including diacritic support
- Discourse SSO is now DiscourseConnect
- Add performance improvement for exclude-by-tag publishing feature
- Add exclude-by-tag publishing feature (>= WP 5.6)
- Add PHP 8.0.0 support
- Error handling, logging and unit tests for comment type detection in comment publishing.
- Add a logging system. This update adds a Logs tab to the plugin’s options menu.
wpdc_comments_countfilter to allow comments count for posts that have not been published to Discourse to be filtered
- Update wp-scripts dev-dependency
- Move Discourse Sidebar styles.css to the root of the
- Bugfix for exception in sidebar when “Post Types to Publish” is set to “Page”.
- Add Direct Database Publication option to deal with concurrency issues that may arrise when the plugin is used in conjunction with object caching plugins
- Fix state being initialized for unallowed post types
- Improve state handling in the Discourse Sidebar
- Prevent Discourse post metadata from being updated via post API endpoints
- Fix paginated results not being handled by get_discourse_groups utility function
- Fix Publish to Discourse checkbox being unchecked for scheduled posts
- Fix blank template not being loaded for sites that have enabled the ‘hide WordPress comments’ option
- Fix comment template sometimes being modified for wrong post type
- Update copy for SSO Client settings to suggest using the WordPress domain instead of a wildcard character in the Discourse
sso client secrets setting
- Add explicit permission callback to update-user REST Route for WordPress 5.5
- Remove Force Publish option for when the Classic Editor is used to publish posts
- Fix issue that was causing the comment-link, instead of Discourse comments to be displayed in some cases
- Fix Remove WordPress Comments Template option not being respected
- Fix issue with caused by updated Discourse tagging restrictions
- Fix issue that was causing Unlink Topic UI to not get updated when the Unlink Topic button was clicked on WordPress 5.5
- Fix issue that was preventing the WordPress comment template from being loaded for posts not published to Discourse
- Add option to only display comments for posts published to public Discourse categories
- Pass WordPress post to wp_discourse_publish_categories filter; apply the wp_discourse_publish_categories filter when Block Editor is used
- Add wpdc_after_sso_client_user_update action hook to allow WordPress user to be updated from returned Discourse user-data
- Strip HTML comment blocks from WordPress post before publishing post to Discourse
- If the Add Featured Links option is enabled, update the Discourse topic’s featured link when post updates are pushed from
WordPress to Discourse
- Fix issue with the Auto Publish setting for posts that were unlinked from Discourse prior to WP Discourse version 2.0.3
- Add static get_discourse_comments function to allow comments to be displayed without loading the comments template
- Update wpdc_auto_publish_overridden post metadata when a post is unlinked from Discourse to prevent the plugin from attempting
to publish updates to the post to Discourse
- Extract images and embedded video URLs from blocks before publishing full post content to Discourse
- Prevent Auto Publish setting from auto publishing post updates to Discourse. The Auto Publish setting is only applied when a post
is initially published on WordPress. If the post is later updated on WordPress, to update the content on Discourse, click the Update Topic
button from the WP Discourse sidebar.
- When Discourse is the SSO provider for WordPress, pass WordPress
redirect_toURL parameter to the SSO process.
- Fix connection status notice displaying a success message when no API credentials have been entered
- Fix Open Links in New Tab setting not being applied to Join Discussion link
- Use WPDISCOURSE_PATH constant when loading plugin files
- Use unique transient key for DiscourseUtilities::get_discourse_categories. This function returns more data than is stored in
the transient that is set for internal use by the plugin.
- Fix incorrectly formatted header keys
- Fix WordPress as SSO client checking for matched email addresses after SSO external_id has been set
- Fix incorrect markup on user profile page
- Fix tag errors not being correctly handled
- Fix disallowed tags not being able to be deleted through the Classic Editor meta box
- Enable the auto-publish option for both the Block and the Classic editors
- Remove mbstring dependency
- Move Discourse Username field to its own section of the user profile page
- Allow admins to mark an email address as valid from the user profile page
- Fix bug that was removing
+character from email addresses when Discourse is the SSO Provider for WordPress
- Add ‘Force Publish Max Age’ option
- Various minor bug fixes
- Add ‘wpdc_load_comments_template_for_user’ filter to allow the comments template to be loaded conditionally
- Fix don’t enqueue Discourse sidebar script if no post types have been selected
- Fix don’t cache database call to GET_LOCK when retrieving comments from Discourse
- Fix don’t cache database call to GET_LOCK when publishing posts from WordPress to Discourse
- Don’t return Discourse comments from Rest Route for password protected posts
- Improve copy for plugin settings
- Don’t allow comments to be viewed for drafts
- Fix unhandled publishing error types when the Classic Editor is being used
- Pass the post_id to the wpdc_publish_format_title filter
- Fix encoding of SSO client redirect URL
- Update wp_new_user_notification function to mirror latest WordPress version
- Fix calling the ‘wp_login’ action with the wrong parameters
- Fix listing unlisted topics for posts published with the Block Editor
- Add ‘wpdc_discourse_username’ filter to allow publishing username to be overwritten before post is published
- Add ‘wpdc_publish_unlisted’ filter to allow filtering which topics should be published as unlisted
- Fix copy for Do Not Display Discourse Name Field option
- Add post_id parameter to publish_format_html template for use in custom templates
- Fix route name for custom post types
- Add wpdc_sso_client_query filter
- Update SSO Client configuration instructions
- Add Pin Topic component to Block Editor sidebar
- Respect allow-tags and max-tags options in Block Editor sidebar
- Check if the Block Editor is being used to allow for switching between Block and Classic editors
- Add support for the Gutenberg editor
- Update HTML templates to for WordPress twentyninteen theme
- Apply ‘the_content’ filter to full post content that will be published to Discourse
- Add option to not load the WordPress comment template for posts that have not been published to Discourse
- Improve the UI for choosing comment display options
- Fix topics added to the Discourse approval queue not being handled correctly on WordPress
- Fix tags that have been added to draft posts not being saved
- Don’t call sync_sso when the login request originates on Discourse
- Add wpdc_after_sync_sso action hook
- Add wpdc_publish_private_post filter hook
- Fix max-tags option being accessed when it has not been set
- Fix make sure category name is returned before including it in force-publish message
- Fix target attribute not being set when Open Links in New Tab option selected
- Fix Start Discussion text not being set when no comments are displayed on WordPress
- Add discourse_post_avatar_template_size filter
- Add discourse_participant_avatar_template_size filter
- Fix typo in wpdc-link-to-topic CSS selector name
- Add option to tag topics when they are published to Discourse
- Add option to clear cached comment HTML
- Add wpdc_bypass_sync_sso filter
- Fix make sure Discourse
namefield is present
- Only cache comment HTML when the option is enabled
- Clear comment HTML cache when SSO settings are updated
- Replace polls in comments with a link to the poll
- Add a ‘redirect’ parameter to the SSO client shortcode
- Cache comment HTML that is generated by the plugin
- Add SSO Client Login Form Redirect setting
- Remove query params from URL when linking to existing topic
- Allow comment_url tag to be used in the comment_html template
- Require confirmation before updating or unlinking post
- Fix timezone offset that is used for displaying Discourse comments published-at date
- Add an option to have a link to the Discourse topic instead of displaying comments beneath the post
- Add a Join Discussion text option for when comments exist on the Discourse topic, but aren’t being pulled to WordPress
- Fix error in Redirect Without Login option
- Add wpdc_before_webhook_post_update filter hook that can be used to process Discourse webhooks after they have been validated by the plugin
- Add excerpt_length and use_full_post options to wp_discourse_excerpt filter
- If a custom excerpt has been set, check if it’s empty before using it as the Discourse post content
- Fix bug in SSO client shortcode that was causing it to display the ‘Link your account’ text for accounts that were already linked
- Don’t use iconv_strlen for validating settings
- Provide proper webhook URL for all permalink styles
- Make options that need to be copied to Discourse easier to select
- Add option for publishing posts as unlisted Discourse topics
- Add option for publishing posts as pinned topics
- Update API static methods
- Fix SSO Client nicename error when a full name is in the Discourse name field
- Add an optional stylesheet for fixing oneboxes and quotes in comments
- Modify add_user_to_discourse_group and remove_user_from_discourse_group functions to avoid To Many Request issues
- Allow add_user_to_discourse_group and remove_user_from_discourse_group functions to take multiple comma separated groups (no spaces allowed between groups!)
- Sync SSO records on every login if Create or Sync Discourse Users on Login option is enabled
- Add Sync Logout with Discourse option to SSO Client settings
- Add option to link posts to existing WordPress topics
- Fix comment count when the update-topic webhook is enabled and posts are deleted on Discourse
- Change the force-publish option so that it always publishes to the default category
- Add ‘wpdc_comment_body’ filter that gives access to the Discourse comment content before it’s added to the comment template
- Fix comment character encoding for libxml versions < 2.8.0
- Add an option to load Discourse comments with an ajax call
- Add action hooks to SSO Provider functions
- Add unlink_from_discourse checkbox to deal with cases where a post’s associated topic has been deleted on Discourse
- Improve error message when posts fail to publish to Discourse
- Add filter to sso_client redirect_url
- Fix sanitization of sso_secret and webhook_secret
- Fix require activation for users created through API
- Fix get_discourse_user_by_email function for older versions of Discourse
- Fix check Discourse version to make sure admin/users/list/all.json?email is available
- Add get_discourse_stats API function
- Don’t display Publish to Discourse checkbox when Force Publish is enabled
- Always publish updates when Force Publish is enabled
- Add warning to SSO Provider tab when current user’s email doesn’t match an admin email on Discourse
- Remove Auto Login option
- Add Auto Create User option
- Add get_discourse_user API function
- Add get_discourse_user_by_email API function
- Add create_discourse_user API function
- Add add_user_to_discourse_group and remove_user_from_discourse_group API functions
- Add Force Publish option
- Use DOMDocument to convert relative URLs returned from Discourse to absolute URLs
- urlencode SSO client return path
- Fix Discourse Publish setting not being respected for draft and pending posts
- Allow posts to be updated on WordPress without being republished to Discourse
- Add option to open links to Discourse in a new tab
- Set minimum WordPress version to 4.7
- Add wpds_sync_discourse_comments action
- Fix enqueue network styles bug
- Fix SSO auto-login bug
- Add Discourse webhook endpoint for syncing Discourse Username with Discourse
- Add network options page for multisite installations
- Enable using Discourse as the SSO Provider for WordPress in multisite installations
- Add function for syncing userdata
- Add Discourse webhook endpoint for syncing Discourse topics with WordPress posts
- Add a multisite configuration option for use when a single Discourse forum is connected to a network of WordPress sites
- Add an option to create a featured_link on Discourse for posts that are published through the plugin
- Add an option to not display the Discourse Name field on the WordPress user’s profile page
- Add wpdc_sso_before_login_redirect action hook
- Remove the debug_mode option, add a wpdc_comment_sync_period filter that can be used in its place
- Fix email verification when MemberPress registration is used
- Improve description of Publishing Username and Auto Login User settings fields
- Fix SSO logout bug on private forums
- Add force-avatar-update option to SSO Provider options
- Add use-real-name-as-discourse-name option to SSO Provider options
- Add ‘wpdc_single_page_comment_number_sync’ filter, to be used for setting which posts and pages use the longer ‘discourse_archive_page_sync_period’
for syncing comment numbers on archive pages
- Test against WordPress 4.7.5
- Add filter to SSO parameters
- Fix Travis CI configuration file
- Save Discourse categories as an option, instead of as a transient
- Only update Discourse category list when ‘Force Category Update’ option is selected, (automatically deselected after a single request)
- Publish to correct category if an error is returned when fetching categories from Discourse
- Add success/failure notices to the post edit page after publishing Discourse post
- Add email notification option for when a post fails to publish to Discourse
- Add unit and integration tests
- Fix transfer of SSO options from previous version
- Add SSO provider option to automatically create and log in Discourse users when a user logs into WordPress
- Move the SSO Client and SSO Provider options onto separate options tabs
- Add inline documentation for plugin options
- Fix test for minimum php version requirements
- Always use
wp_safe_redirect. Add the Discourse forum URL to the ‘allowed_redirect_hosts’ array
- Merge default options with saved options on plugin activation
- Fix SSO avatar issues
- Add option to sync existing users by email when Discourse is used as the SSO provider
- Make it possible to sync logout with Discourse when Discourse is used as the SSO provider
- Add configurable-text settings for external SSO
- Add warning before publishing to Discourse as ‘system’
- Add action after creating user through external SSO, (useful for sending a ‘welcome’ email)
- Allow option input values to be set to 0
- Refactor admin code
- Add hooks for extending options pages with plugins
- Fix tests for minimum php and WordPress requirements
- Remove autoloader
- Populate the Discourse username field when using Discourse as the SSO provider
- Delete options for multi-site installations
- Improve copy
- Allow Discourse to be used as the SSO provider for WordPress
- Display saved meta-box values for scheduled and draft posts
- Test against WordPress version 4.7
- Halt plugin installation if >= PHP-5.4.0 is not available
- Halt plugin installation WordPress version is < 4.4.0
- Don’t override WordPress new-user notification email when SSO is not enabled
- Delete old
discourseoptions on plugin uninstall if it is still in the database
- Don’t call
datetimereturned from Discourse
- Add WordPress comments_number to Discourse comments_number when both are used
'.screen-reader-text'class to screen-reader text
'.discourse-comments-area'class to Discourse comments area
- Add filter to Discourse categories before displaying them in the ‘Publish to Discourse’ meta-box
- Fix: Don’t call
- Fix: Don’t logout from Discourse when SSO is not enabled
- Move WooCommerce support into a separate plugin
- Break settings page into tabbed sections
- Add a settings section for customizing all user facing text
- Display the Discourse username instead of the fullname in the default comments template
- Add a ‘Participants’ heading
- Don’t display the category-select option in posts that have already been published to Discourse
- Only hook into the WordPress
comments_numberhook when both Discourse and WordPress comments are used for a post
- Sync changed post title with Discourse
- Get options more efficiently
- Add a longer sync period for comments on archive pages
- Add a ‘Discourse link text’ option
- Copy ‘discourse’ options to the new option_groups when upgrading from versions < 1.0.0
- Delete the ‘discourse’ option when upgrading from versions < 1.0.0
- Improve option descriptions
- Return ‘discourse_comments_count’ from WordPress
get_comments_numberfunction when WordPress comments are not being used
- Disable publishing to Discourse when a WordPress post is published through
- Strip html tags from WordPress titles before sending them to Discourse
- Fix: Retrieve private categories for categories list
- Security update
- Set expiration time on
require_activation => 'true'for SSO request after email address change on WordPress
- Sync logout from WordPress with Discourse
- Require activation on Discourse when email address can’t be verified by WordPress
- Tested up to WordPress 4.6
- Fix: WordPress comment box showing when there are no WordPress comments
- Fix: existing WordPress comments always showing
- Fix: youtube data attribute being escaped by wp_kses_post
- Substitute comment url for comment_url tag
- Internationalize comments_number function
- Partial fix for emoji relative paths
- Add option to redirect to Discourse without login
- Log error if validation filter is missing
- Check for post_types array before trying to access it
- Verify email before logging into Discourse
- Restructure code
- Move templates out of options
- Validate settings
- Add notices to indicate connection status
- Sanitize admin options page
- Sanitize comment template output
- Add type argument to text input method
- Use cached categories when there is a configuration error
- Fix name property not available in participants array
add_query_argundefined offset notice
- Update Discourse post on WP post update
- Better method for including comments script
- Allow choosing Discourse category per post
- Replace avatar URL function
- Fix timezone for custom timestamp