simon
June 26, 2018, 12:12am
2
You could do it manually with this:
The WP Discourse plugin lets you link an existing Discourse topic to a WordPress post. To do this, go to the post’s edit page on WordPress and select Link to Existing Topic from the Discourse meta box. In the Topic URL field, enter the URL of a topic from your forum. You can get the URL from your browser’s address bar, or from any of the topic’s share links. (Note: you need to be on at least version 1.6.5 of the plugin to be able to use the share link URLs.)
[54%20PM]
Click the WordPress Publi…
Or write a script that calls a function similar to this:
// translators: Unlisted topic option description. Placeholder: webhook options link.
__( 'If you have configured the %1s, topics will be listed when they receive a comment.', 'wp-discourse' ),
$webhook_options_link
);
?>
<label for="unlist_discourse_topic">
<input type="checkbox" name="unlist_discourse_topic" value="1"
<?php checked( $unlisted ); ?> >
<?php esc_html_e( 'Publish as Unlisted', 'wp-discourse' ); ?><br>
<div class="wpdc-publish-info"><?php echo wp_kses_post( $info_message ); ?></div>
</label>
<?php
}
/**
* Outputs the tag_topic input.
*
* @param int $post_id The ID of the post.
*/
protected function tag_topic_input( $post_id ) {
Since you only have the topic titles, and not the topic ids, I think you’ll need to make a request to the Discourse topic without the id and get the redirect that’s returned from Discourse. Something like curl http://localhost:3000/t/your-topic-without-the-id -s -L -I -o /dev/null -w '%{url_effective}'
1 Like