Editing linked Discourse posts/topics without changes being overridden by Wordpress?


(Mike) #1

Hey all!

We’re using the WP Discourse Plugin for SSO and to replace the WP Comments with discourse.

After publishing a WP post to Discourse, I manually remove any shortcodes from the Discourse post and generally add in a few extra keywords to make it easier for our members to search…

The problem is if I ever need to update something on the WP side - as soon as I hit publish the linked Discourse post is overridden by the updated WP post.

We’re also using some custom post types within our theme, and these create Discourse posts with no content in them (aside from the Title)… If we edit the Discourse posts to include any info, this is overridden to a blank post again if we ever make any changes on the WP side.

Q: Is it possible to keep the two linked for comments etc., but prevent future post update/content ‘pushes’ from WP to Discourse for each post?


(Simon Cossar) #2

No, but it should be. I’ll get it into the next update - sometime later this week.

Is this something you’re wanting to fix?


(Mike) #3

That’s awesome, thanks Simon!

RE: Custom Post types - this will be less of an issue (for us atleast) once your update gets pushed through as we’ll be manually updating the content in the Discourse post anyway and it will no longer revert to blank automatically :slight_smile: I can definitely see how it would save some time if there was ever a fix, but not critical in this current use-case.

Thanks again Simon :raised_hands:t2:


(Simon Cossar) #4

If you have selected the custom post type in the wp-discourse ‘Post Types to Publish’ option, it should publish to Discourse without any problem. I’m not sure what could be going on with that.

I will make a change to the wp-discourse plugin so that post content is only republished to Discourse if an ‘Update Discourse Topic’ checkbox is selected on the WordPress post_edit page. If you don’t want to have to manually update posts on Discourse to remove shortcodes, you could probably remove them on WordPress by using the first function in the Dealing With Shortcodes section of this topic: WP Discourse Plugin Tips and Tricks (it will remove anything that looks like a shortcode, but leave any content that occurs between the shortcodes.) You could possibly also use that function to add some keywords to the excerpt.


(Mike) #5

RE: Custom Post Type - yeah I’ve got the ‘Course’ custom post type selected in ‘Post Types to Publish’ so not sure whats up there. If I can give any specific info to help, just let me know what you need!

Update sounds great! Awesome you guys are so onto this. Really appreciate it!
Thanks for the link. I came across that last week, but figured we’ve got to manually update each post anyway so no extra work to just remove any shortcodes (we rarely use them anyway).

Thanks again Simon!


(Simon Cossar) #6

Is the content of the Course posts protected in any way?


(Mike) #7

Yes, the Course posts are locked down with Wishlist Member, but all our other posts on that site are too and they seem to work fine…


(Simon Cossar) #8

Is the Course post type created through a plugin? The wp-discourse plugin gets the post content from the post_content property of the post that’s being published. It’s possible that property isn’t being set on the Course custom post type. It could be something like course_description instead.


(Mike) #9

Yep, it’s created through a Plugin - I think you’re right re: the ‘post_content’ field not being used for that custom post type


(Mike) #10

Hey @Simon_Cossar! Just touching base to see if this one has been pushed through yet? Not trying to rush, just can’t see it in WP yet so checking to see if I’ve missed anything.


(Mike) #11

Hey @Simon_Cossar! Don’t mean to be chasing you up on this, I haven’t noticed the setting in WP just yet - have I missed it somewhere, or is the update still in the works?

Thanks!


(Simon Cossar) #12

Sorry, I haven’t got it done yet. It looks like I have to update the plugin tomorrow for something else, so I"ll add this in at the same time. Thanks for the reminder.


(Mike) #13

Awesome. Thanks @Simon_Cossar


(Simon Cossar) #14

As of version WP Discourse version 1.4.5 posts are no longer automatically republished to Discourse when they are updated on WordPress. After publishing a post, the Publish to Discourse meta-box changes to this:

update_topic

To republish the topic to Discourse, select the Update Discourse Topic checkbox.

Note: if you have not unselected the ‘embed truncate’ option on Discourse, Discourse will pull the most recent version of the post from WordPress when the Show Full Post button is clicked.


(Mike) #15

Thats fantastic! Thanks @Simon_Cossar - much appreciated!