# Discourse WordPress plugin version 0.7.0

**URL:** https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461
**Category:** WordPress
**Created:** [May 18, 2016, 10:54pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461 "2016-05-18T22:54:39Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![benword](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benword/32/493782_2.png) [@benword](https://meta.discourse.org/u/benword)
#### Post date: [May 18, 2016, 10:54pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/1 "2016-05-18T22:54:39Z")

</div>

The [wp-discourse plugin](https://github.com/discourse/wp-discourse) got updated to version 0.7.0 just now. Thanks to @simon, @pjv, @Grex315, @tnorthcutt, and @AdamCapriola for these updates!

⚠ Have you made changes to the HTML templates at all? The templates are no longer handled from the plugin admin, they must be customized with filters. See [Template Customization](https://github.com/discourse/wp-discourse/wiki/Template-Customization) from the GH wiki.

### 0.7.0: May 18th, 2016

- Move templates out of options ([#194](https://github.com/discourse/wp-discourse/pull/194))
- Validate settings ([#189](https://github.com/discourse/wp-discourse/pull/189))
- Add notices to indicate connection status ([#193](https://github.com/discourse/wp-discourse/pull/193))
- Sanitize admin options page ([#196](https://github.com/discourse/wp-discourse/pull/196))
- Sanitize comment template output ([#195](https://github.com/discourse/wp-discourse/pull/195))
- Add type argument to text input method ([#192](https://github.com/discourse/wp-discourse/pull/192))
- Use cached categories when there is a configuration error ([#191](https://github.com/discourse/wp-discourse/pull/191))
- Fix name property not available in participants array ([#187](https://github.com/discourse/wp-discourse/pull/187))
- Use `wp_get_current_user` ([#185](https://github.com/discourse/wp-discourse/pull/185))
- Fix `add_query_arg` undefined offset notice ([#184](https://github.com/discourse/wp-discourse/pull/184))
- Update Discourse post on WP post update ([#176](https://github.com/discourse/wp-discourse/pull/176))
- Better method for including comments script and other small tweaks ([#181](https://github.com/discourse/wp-discourse/pull/181))
- Allow choosing Discourse category per post ([#177](https://github.com/discourse/wp-discourse/pull/177))
- Replace avatar URL function ([#172](https://github.com/discourse/wp-discourse/pull/172))
- Fix timezone for custom timestamp ([#162](https://github.com/discourse/wp-discourse/pull/162))

* * *

You can download the new version from [Releases · discourse/wp-discourse · GitHub](https://github.com/discourse/wp-discourse/releases) or via [Composer](https://packagist.org/packages/discourse/wp-discourse)

---

<div class="post-metadata">

### Author: ![Roxelle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roxelle/32/46924_2.png) [@Roxelle](https://meta.discourse.org/u/Roxelle)
#### Post date: [May 19, 2016, 12:18pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/2 "2016-05-19T12:18:01Z")

</div>

Hei @benword, its possible see the example in action of this plugin?

---

<div class="post-metadata">

### Author: ![TimeDoctor](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@TimeDoctor](https://meta.discourse.org/u/TimeDoctor)
#### Post date: [May 27, 2016, 5:20am UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/3 "2016-05-27T05:20:18Z")

</div>

Any chance it’ll get submitted through [wordpress.org](http://wordpress.org) so that we can get automated updates that don’t lose settings? I assume this is a pain in the butt to do.

---

<div class="post-metadata">

### Author: ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)
#### Post date: [May 27, 2016, 10:14am UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/4 "2016-05-27T10:14:09Z")

</div>

> [@Roxelle](#):
>
> its possible see the example in action of this plugin?

Sure. Check out any post in [http://blog.discourse.org/](http://blog.discourse.org/) for instance. We’re using this plugin.

> [@TimeDoctor](#):
>
> Any chance it’ll get submitted through [wordpress.org](http://wordpress.org) so that we can get automated updates that don’t lose settings?

Yep, we’re actively working towards this together with @simon plus @benword kindly offering his guidance.

---

<div class="post-metadata">

### Author: ![holden](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@holden](https://meta.discourse.org/u/holden)
#### Post date: [May 27, 2016, 1:10pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/5 "2016-05-27T13:10:22Z")

</div>

> [@benword](#):
>
> Allow choosing Discourse category per post

Very cool!

Thank you 🙂

---

<div class="post-metadata">

### Author: ![Swissendo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/swissendo/32/116893_2.png) [@Swissendo](https://meta.discourse.org/u/Swissendo)
#### Post date: [July 7, 2016, 10:03am UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/6 "2016-07-07T10:03:16Z")

</div>

It seems that the plugin was submitted to the Plugin Directory a few days ago:

> **[WP Discourse](https://wordpress.org/plugins/wp-discourse/)**
>
> This plugin allows you to use Discourse as a community engine for your WordPress website. The plugin is not a substitute for Disqus type commenting sy …

Looks like it’s the official plugin, but i find it quite strange that nobody mentioned this here or on Github. Can anyone confirm that this is the real deal and we won’t lose our settings after each update with this?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 7, 2016, 2:25pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/7 "2016-07-07T14:25:25Z")

</div>

Yes that’s the official wp-discourse plugin. We want to finish writing the plugin’s documentation and update its version number before giving it much publicity on here. If you already have the plugin installed, wait until the version number goes past 0.7.0 before updating it. For a new installation of the plugin, using the version in the plugin directory will be fine.

---

<div class="post-metadata">

### Author: ![elijah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elijah/32/104055_2.png) [@elijah](https://meta.discourse.org/u/elijah)
#### Post date: [July 20, 2016, 12:40am UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/8 "2016-07-20T00:40:51Z")

</div>

I’ve got a test version of Discourse installed (last week) and a test blog created (today) and I’m seeing quirks. Before these tests, I went through all of the Wordpress updates. Wordpress 4.5.3, and wp-discourse Version 0.9.1 (which I do not see a topic for).

Note settings for historical comments and changed minimum score:

 ![](https://global.discourse-cdn.com/meta/original/3X/4/1/41fcbe8dbc45bbefd185ad8113b616f1072cb218.png)

Yet:

 ![](https://global.discourse-cdn.com/meta/original/3X/5/3/536653add71c9d4549f67b76f063dc68f3ae8339.png)

And that’s even though two users have commented on the Discourse side:

 ![](https://global.discourse-cdn.com/meta/original/3X/a/6/a676fb4dda9d21df51d1ead26b05f142af027f5a.png)

Suggestions for what I might be doing wrong?

(I rarely do anything with Wordpress, so I’m not very sure I’ve done everything right.)

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 20, 2016, 2:00am UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/9 "2016-07-20T02:00:11Z")

</div>

Check your setting for ‘debug mode’. By default the plugin only syncs the Discourse comments once every 10 minutes. By enabling ‘debug mode’ it will sync the comments on every page request.

 ![](https://global.discourse-cdn.com/meta/original/3X/c/9/c97497317408360dda152ed3f34c5c4f3a7e4f2e.png)

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 20, 2016, 2:31am UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/10 "2016-07-20T02:31:44Z")

</div>

It looks like the problem might be your ‘Min number of replies’ setting. I think the default value of that is now ‘1’.

---

<div class="post-metadata">

### Author: ![Swissendo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/swissendo/32/116893_2.png) [@Swissendo](https://meta.discourse.org/u/Swissendo)
#### Post date: [July 20, 2016, 3:33pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/11 "2016-07-20T15:33:11Z")

</div>

I updated to 0.9.1, but sadly it didn’t fix the few quirks I’ve had with 0.7.0 and earlier versions of the plugin. Which are:

- The `{comment_url}` tag seems to only output the current page URL with `/%7Bcomment_url%7D` added to the end. For example: [http://blog.discourse.org/2016/07/reply-by-email-enabled-for-all-discourse-customers/{comment\_url}](http://blog.discourse.org/2016/07/reply-by-email-enabled-for-all-discourse-customers/%7Bcomment_url%7D).

- As mentioned on [GitHub](https://github.com/discourse/wp-discourse/issues/142), the Emoji images sometimes have the wrong URL. The weird thing is that this only happens with some Emojis and comments, while others are fine.

- I was able to edit `discourse-comment.php` to change the `Leave a reply/Replies/Reply`-Strings, but I would have to do that with every update. Is there any way to do this via the `functions.php`? I’ve tried the [method from the wiki](https://github.com/discourse/wp-discourse/wiki/Tips-and-Tricks#customize-any-text-displayed-by-the-plugin), but that didn’t work.

Is there any way to fix these problems? And thanks to everyone for the great new features added in 0.7.0 and above, which are awesome! 🎉

---

<div class="post-metadata">

### Author: ![elijah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elijah/32/104055_2.png) [@elijah](https://meta.discourse.org/u/elijah)
#### Post date: [July 20, 2016, 5:41pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/12 "2016-07-20T17:41:42Z")

</div>

Yeah, I tried that. The main index page shows “2 comments”, but the actual post page (where the comments would appear) still shows “Start the discussion” AND the supposedly disabled Wordpress-native comment. And that’s this morning, well after a ten minute update window.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 20, 2016, 6:32pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/13 "2016-07-20T18:32:50Z")

</div>

But did you try this?

> [@simon](#):
>
> It looks like the problem might be your ‘Min number of replies’ setting. I think the default value of that is now ‘1’.

---

<div class="post-metadata">

### Author: ![elijah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elijah/32/104055_2.png) [@elijah](https://meta.discourse.org/u/elijah)
#### Post date: [July 20, 2016, 7:25pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/14 "2016-07-20T19:25:23Z")

</div>

No, I missed that. Adding more replies did work, so that’s it.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 20, 2016, 8:09pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/15 "2016-07-20T20:09:46Z")

</div>

> [@Swissendo](#):
>
> The {comment\_url} tag seems to only output the current page URL with /%7Bcomment\_url%7D added to the end.

I’ll look at that.

> [@Swissendo](#):
>
> The weird thing is that this only happens with some Emojis and comments, while others are fine.

Yes this is because we’re trying to fix the Discourse urls with a regular expression 😛

> <https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454>

It falls apart if there is an absolute image path followed by a relative one. I think the emoji image paths have been fixed in the latest version of Discourse, so the best solution is to update the version of Discourse you are using.

> [@Swissendo](#):
>
> I was able to edit discourse-comment.php to change the Leave a reply/Replies/Reply-Strings, but I would have to do that with every update. Is there any way to do this via the functions.php? I’ve tried the method from the wiki, but that didn’t work.

Does this work for you?

```plaintext
function discourse_no_replies( $input ) {
	ob_start();
	?>

	<div id="comments" class="comments-area">
		<div class="respond comment-respond">
			<h3 id="reply-title" class="comment-reply-title"><a href="{topic_url}">Join the discussion on our forum</a></h3>
		</div>
	</div>

  <?php
	$output = ob_get_clean();
	return $output;
}
add_filter( 'discourse_no_replies_html', 'discourse_no_replies' );

```

* * *

Edit: If all you are trying to do is change the text content, there is an easier way to do it. I’ll add some documentation for overriding the plugin’s text content soon. But here is a quick example that could be added to your theme’s functions.php file.

```plaintext
add_filter( 'gettext', 'change_continue_discussion_text', 20, 3 );
function change_continue_discussion_text( $translated_text, $text, $domain ) {
	switch ( $translated_text ) {
		case 'Continue the discussion' :
			$translated_text = __( 'Join the discussion', 'wp-discourse' );
			break;
	}

	return $translated_text;
}

```

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 20, 2016, 11:01pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/16 "2016-07-20T23:01:34Z")

</div>

> [@Swissendo](#):
>
> The {comment\_url} tag seems to only output the current page URL with /%7Bcomment\_url%7D added to the end.

Thanks for noticing that! It’s not included in any of the default templates, but it wasn’t doing anything at all. I’ve sent a PR that makes the `{comment_url}` equal the post\_permalink + the comment number.

---

<div class="post-metadata">

### Author: ![Swissendo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/swissendo/32/116893_2.png) [@Swissendo](https://meta.discourse.org/u/Swissendo)
#### Post date: [July 21, 2016, 7:03am UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/17 "2016-07-21T07:03:48Z")

</div>

Yes, I’ve tried the `add_filter( 'gettext', 'change_continue_discussion_text', 20, 3 );` method, but that erased several text blocks from the panel, while doing nothing on the site, so I just edited the plugin. I’m not even shure if I can translate that part, since it hooks into the `comments_number` and overwrites it? Or do I just need to use `discourse_comments_count`?

```
/**
 * Returns the comments number.
 *
 * If Discourse comments are enabled, returns the 'discourse_comments_count', otherwise
 * returns the $count value. Hooks into 'comments_number'.
 *
 * @param int $count The comment count supplied by WordPress.
 *
 * @return mixed|string
 */
function comments_number( $count ) {
	global $post;
	if ( $this->use_discourse_comments( $post->ID ) ) {
		$this->sync_comments( $post->ID );
		$count = get_post_meta( $post->ID, 'discourse_comments_count', true );
		if ( ! $count ) {
			$count = 'Leave a reply';
		} else {
			$count = ( 1 === intval( $count ) ) ? '1 Reply' : $count . ' Replies';
		}
	}

	return $count;
}

```

Also, thank you so much for your help and the quick fixes regarding the Emojis and `{comment_url}`!

**Edit:**

I’ve just noticed another problem with `comments.js` and links to YouTube. It seems unable to get the correct ID and replaces it with “undefined”:

```
<a href="https://www.youtube.com/watch?v=undefined" class="fancybox-youtube">https://www.youtube.com/watch?v=undefined</a>

```

This worked fine on 0.6.6…strange.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 21, 2016, 2:19pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/18 "2016-07-21T14:19:42Z")

</div>

> [@Swissendo](#):
>
> I’m not even shure if I can translate that part

Right, that bit of text has not been internationalized. I’ll do that right away and then hooking into `gettext` will work.

> [@Swissendo](#):
>
> I’ve just noticed another problem with comments.js and links to YouTube. It seems unable to get the correct ID and replaces it with “undefined”:

Thanks, I’ll fix that.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 21, 2016, 3:26pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/19 "2016-07-21T15:26:53Z")

</div>

> [@Swissendo](#):
>
> I’ve just noticed another problem with comments.js and links to YouTube. It seems unable to get the correct ID and replaces it with “undefined”:

I can’t reproduce this. If you get a chance could you try again?

Edit: OK, now I can reproduce it. It’s being escaped by WordPress.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 21, 2016, 7:43pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461/20 "2016-07-21T19:43:00Z")

</div>

Just pushed version 0.9.3 to the WordPress plugin repository. It includes fixes for:

- substituting the comment url for the comment\_url tag
- not escaping the `data-youtube-id` attribute
- internationalizing the `comments_number` function

Here’s a sample function for changing the comments number text:

```plaintext
add_filter( 'gettext', 'change_comments_number_text', 20, 3 );
function change_comments_number_text( $translated_text, $text, $domain ) {
	switch ( $translated_text ) {
		case 'Leave a reply' :
			$translated_text = __( 'Please leave a reply', 'wp-discourse' );
			break;

		case 'Reply' :
			$translated_text = __( 'Response', 'wp-discourse' );
			break;

		case 'Replies' :
			$translated_text = __( 'Responses', 'wp-discourse' );
			break;
	}

	return $translated_text;
}

```

[Next page](https://meta.discourse.org/t/discourse-wordpress-plugin-version-0-7-0/44461.md?page=2)
