ההודעה לא פורסמה כראוי ל-Discourse – חסר permalink בתגובה בעת API

I’m experiencing an issue with the Discourse WordPress plugin when trying to publish a WordPress post to Discourse.

Issue Description:

When I create a new post on my WordPress site and check the “Publish to Discourse” option under the Discourse tab before publishing, the post successfully publishes to WordPress. However, the Discourse topic is not created at that time.

Later, if I edit the same post and go to the Discourse tab again, then click “New Topic” and publish to Discourse, the post does get created on the Discourse site. But this Discourse topic is not linked with the original WordPress post. There’s no permalink association or metadata saved back to the post.

Debug Findings:

While debugging, I noticed the call to:
/wp-json/wp-discourse/v1/publish-topic

returns the following response:

{
“publish_response”: “success”,
“permalink”: “”
}

As you can see, the “permalink” field is empty. This appears to be the core reason the Discourse topic is created but not linked back to the WordPress post (i.e., the permalink isn’t stored in the postmeta, so the link between WP and Discourse is broken).

Could you please help investigate why the permalink is returning empty in the API response? Is there a plugin misconfiguration or a bug in the publishing workflow?

Let me know if you need any logs or further information. Appreciate your help!

Hello @techops, could you please share any relevant logs from WP Discourse > Logs in Wordpress. Please also share the meta file from that view if possible.

לייק 1

Hi Angus,

Thanks for the quick response.

There are no logs available under WP Discourse > Logs in the WordPress dashboard, the log view is currently empty.

However, here is the meta file you requested: Discourse meta - Google Docs

Please let me know if there’s anything else I can provide to help troubleshoot this issue.

Thanks!

Thanks @techops, there’s a few things I’d like to to do.

Please disable this setting in the Publishing settings

Send Email Notification on Publish Failure

Please make sure this setting is enabled in Publishing settings

Verbose Publication Logs

You have a number of post types set up for publication

post,event,groups,collections,podcast

Which post type are you experiencing this issue with? If it’s not post could you explain a bit more about how that post type is set up?

Hi Angus,
I’ve applied the suggested settings:

  • Disabled: Send Email Notification on Publish Failure
  • Enabled: Verbose Publication Logs

I’m using the post post type only.

After updating the settings, I created and published a new post to Discourse. Here are the logs generated:

[2025-04-22 15:58:12] publish.INFO: create_post.post_success {"wp_title":"test post 4","wp_author_id":"221","wp_post_id":15068} 
[2025-04-22 15:58:12] publish.INFO: create_post.body_valid {"wp_title":"test post 4","wp_author_id":"221","wp_post_id":15068} 
[2025-04-22 15:58:12] publish.INFO: create_post.after_publish {"post_id":15068,"remote_post_type":"create_post","discourse_post_id":"","discourse_topic_id":"6910","discourse_permalink":""} 

Let me know if you need any additional information or details.

Thanks!

תודה ששיתפת בזה. היומנים האלה נראים לי נורמליים. אני יכול לראות שנוצר נושאת Discourse לאחר שפרסום ב-Wordpress מתפרסם. האם תוכל לאשר בדיוק מה הבעיה? בבקשה תאר את זה במונחים האלה:

  1. אני כותב פוסט ב-Wordpress.
  2. לאחר שהפוסט מתפרסם, אני מצפה לראות…

נסה לא לעשות הנחות טכניות בשלב זה. תודה!

שלום אנגוס,
כתבתי הודעה ב-WordPress.
לאחר הפרסום, אני מצפה לראות את ההתנהגות הבאה:

כאשר תיבת הסימון תחת ‘פרסום ל-Discourse’ מסומנת, ההתנהגות הנכונה היא שייבצר פוסט ב-Discourse, והוא צריך להיות מקושר עם הפוסט ב-WordPress.

עם זאת, מה שקורה בפועל הוא שהפוסט נוצר ב-Discourse, אבל הקישור נעלם מיד. יש ליצרו מחדש ידנית.

תודה!

תודה, אפשר גם לאשר את הדברים הבאים:

  1. באיזה עורך פוסטים של Wordpress אתה משתמש? קלאסי או גוטנברג? האם הפוסטים האלה נוצרו באופן לא סטנדרטי (למשל אני רואה שאתה משתמש ב"Gravity Forms Advanced Post Creation")
  2. תוכל לשתף דוגמה של פוסט Wordpress ודיון ב-Discourse שבהם מתקיימת הבעיה?
  3. האם אתה משתמש בכל תוסף שמשנה את שדות המטא של Wordpress (למשל Advanced Custom Fields)?

Thanks for following up. Here are the details:

  • We are using the Gutenberg editor for creating posts.
  • We are not using any custom field plugins such as Advanced Custom Fields.
  • I’ve recorded a video replicating the issue for your review. You can check it here.

Let me know if you need any additional information or further testing.
If it helps, I can also provide temporary login access so you can explore the setup directly.

Thanks!

Thanks for recording the video. It seems you’re using a custom publication workflow to publish posts.

This may be connected to the issue.

Are you able to try publishing posts without this custom workflow? The way we will get to the bottom of this is a process of elimination. It is likely that one of your customisations is not interoperable with the WP Discourse publish feature set.

Thanks for the suggestion.
I’ve tested publishing posts directly without using the custom workflow, but unfortunately, it still doesn’t work.

Ok, please keep going in that vein. One of your customisations is likely preventing the WP Discourse plugin from saving the post_id and the permalink when a topic is published.

תודה, אנגוס.

זיהיתי את האשם, תוסף ה-SEO של SmartCrawl מתנגש עם WP Discourse. לאחר השבתת SmartCrawl, הפוסטים מתפרסמים ל-Discourse כמצופה וקישורים נכון לפוסטי וורדפרס.

לייק 1

כל הכבוד שמצאת את האשם. אני חושב שכרגע אולי שווה להעביר את זה לצוות התמיכה שלהם, כלומר “הפלאגין שלך נראה מכביד על פלאגינים אחרים בשימוש ב-API של וורדפרס הרגילים…” ואז לתאר את הבעיה. אולי תוכל להפנות אותם לנושא הזה.