Use Generic Copy Whenever Publishing a Post

@simon Right now whenever you publish a post from WordPress to Discourse the two options are excerpt or full post. Is it possible to simply have generic text (ex. Have a comment or question about this lesson? Start the discussion here.)? We are really just using Discourse to use as the discussion platform and bringing over the text from the post in WordPress doesn’t make a lot of sense.

You can do this by customizing the template that is used to send the WordPress content to Discourse. There is some information about how to do that here: WP Discourse template customization

Adding something like this to your functions.php file should work. Insert whatever html you want to use between the closing and opening php tags.

function your_namespace_publish_format_html() {
	ob_start();
	?>

    <p>Generic content to be published to Discourse with every WordPress post...</p>

	<?php
	$output = ob_get_clean();

	return $output;
}
add_filter( 'discourse_publish_format_html', 'your_namespace_publish_format_html' );
4 Likes

This worked perfectly, thank you!

1 Like