There’s an issue with the Restricted Site Access plugin blocking WordPress REST API requests. If you are publishing posts from WordPress to Discourse, and have enabled the WP Discourse Sync Comment Data webhook, you will need to modify the conditional statement in first function that I added. (The Sync Comment Data webhook makes the WP Discourse plugin a lot more efficient on busy sites.)
add_filter( 'restricted_site_access_is_restricted', 'wpdc_custom_restrict_access', 10, 2 );
function wpdc_custom_restrict_access( $is_restricted, $wp ) {
if ( ( ! empty( $wp->query_vars['discourse_sso'] ) && 1 === intval( $wp->query_vars['discourse_sso'] ) ) ||
! empty( $wp->query_vars['rest_route'] ) ) {
return false;
}
return $is_restricted;
}
See this post for details: https://philipnewcomer.net/2016/05/allow-rest-api-restricted-site-access/.