# Problem with publishing topic after moving to a new server

**URL:** <https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064>\
**Category:** WordPress\
**Created:** [June 14, 2024, 8:18am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064 "2024-06-14T08:18:30Z")\
**Posts on this page:** 18\
**Page:** 1

## AI-generated summary

A user is experiencing an issue with automatic publishing of WordPress articles to Discourse after moving their WordPress site to a new server. The problem is that scheduled posts do not generate a Discourse link upon publication, but manually saving the article triggers the link creation. The issue is suspected to be related to the use of WP CLI for cron jobs, as switching to a standard cron setup resolves the problem. The user is advised to ensure all required cron events are triggered when using WP CLI, and the possibility of plugin conflicts or DNS caching is discussed.

<div class="post-metadata">

**Author:** ![Petr\_Mišák](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/petr_mi%C5%A1%C3%A1k/32/184800_2.png) [@Petr\_Mišák](https://meta.discourse.org/u/Petr_Mi%C5%A1%C3%A1k)\
**Post date:** [June 14, 2024, 8:18am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/1 "2024-06-14T08:18:30Z")

</div>

We have a WordPress site where we use Discource to log in and comment on WordPress.  
Everything worked fine until we moved WordPress (which has always run on a different server) to a new IP and a different server.

Since then, we started to get articles in the classic editor that have the settings shown in the image below not getting a Discourse link even after they are automatically published.

I always have to manually go into a particular article and just translate the article, then the Discourse link is created and everything is OK

Any ideas where to look for the cause of the problem?

 ![This image shows a dialog box or interface section related to the Discourse platform, which allows creating a new topic, linking to an existing topic, publishing a post, and selecting a category labeled "Komentáře ke článkům" (which likely means "Comments on Articles" in a language such as Czech or Slovak). (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/3/7/b/37b01e91d77856bdb096a5c9233d062b2d5f9944.png)

---

<div class="post-metadata">

**Author:** ![Petr\_Mišák](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/petr_mi%C5%A1%C3%A1k/32/184800_2.png) [@Petr\_Mišák](https://meta.discourse.org/u/Petr_Mi%C5%A1%C3%A1k)\
**Post date:** [June 17, 2024, 7:13am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/2 "2024-06-17T07:13:45Z")

</div>

Is anyone dropping clues as to where the problem might be?  
The only mention of error I found in the log was this one, but I couldn’t manage to track down anything on this message.

```plaintext
[2024-06-14 06:45:38] webhook_topic.INFO: update_topic_content.update_post_metadata_success {"post_ids":"771554"} 
[2024-06-14 06:45:43] publish.INFO: create_post.post_success {"wp_title":"Konec ikonického designu. Galaxy Buds 3 dostanou zcela nový vzhled","wp_author_id":"94147","wp_post_id":771981} 
[2024-06-14 06:45:43] publish.INFO: create_post.body_valid {"wp_title":"Konec ikonického designu. Galaxy Buds 3 dostanou zcela nový vzhled","wp_author_id":"94147","wp_post_id":771981} 
[2024-06-14 06:45:43] publish.INFO: create_post.after_publish {"post_id":771981,"remote_post_type":"create_post","discourse_post_id":"10416","discourse_topic_id":"5899","discourse_permalink":"https://komunita.svetandroida.cz/t/konec-ikonickeho-designu-galaxy-buds-3-dostanou-zcela-novy-vzhled/5899"} 
[2024-06-14 06:45:43] webhook_topic.ERROR: update_topic_content.response_body_error

```

---

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [June 17, 2024, 7:31am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/3 "2024-06-17T07:31:03Z")

</div>

Probably worth searching Meta for `update_topic_content.response_body_error` 😉

---

<div class="post-metadata">

**Author:** ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)\
**Post date:** [June 17, 2024, 8:42am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/4 "2024-06-17T08:42:37Z")

</div>

Hey @Petr_Mišák

> [@Petr\_Mišák](#):
>
> not getting a Discourse link even after they are automatically published

Have you got an example of such a topic? The example in your logs shows that the Discourse topic was successfully published. That’s what these lines mean

```plaintext
[2024-06-14 06:45:43] publish.INFO: create_post.post_success {"wp_title":"Konec ikonického designu. Galaxy Buds 3 dostanou zcela nový vzhled","wp_author_id":"94147","wp_post_id":771981} 
[2024-06-14 06:45:43] publish.INFO: create_post.body_valid {"wp_title":"Konec ikonického designu. Galaxy Buds 3 dostanou zcela nový vzhled","wp_author_id":"94147","wp_post_id":771981} 
[2024-06-14 06:45:43] publish.INFO: create_post.after_publish {"post_id":771981,"remote_post_type":"create_post","discourse_post_id":"10416","discourse_topic_id":"5899","discourse_permalink":"https://komunita.svetandroida.cz/t/konec-ikonickeho-designu-galaxy-buds-3-dostanou-zcela-novy-vzhled/5899"} 

```

You can see a link to the successfully published topic in the last line of those logs, i.e.

```plaintext
"discourse_permalink":"https://komunita.svetandroida.cz/t/konec-ikonickeho-designu-galaxy-buds-3-dostanou-zcela-novy-vzhled/5899"

```

The webhook error you see immediately after that suggests an issue with the webhook, but it’s not necessarily indicative of an issue with publication per se.

If you could run a new test where you reproduce the issue, and have a look at the `publish` logs that were created, that will give us some insight as to the issue you’ve described.

Also, could you share what you mean by “translate the article”?

> I always have to manually go into a particular article and just translate the article

What exactly are you doing here?

---

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [June 17, 2024, 8:44am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/5 "2024-06-17T08:44:56Z")

</div>

I suspect that your Discourse install might have cached the DNS entry and is using the IP address of your old WP installation. The quickest way to try that is to restart the container and see if the problem goes away.

---

<div class="post-metadata">

**Author:** ![Petr\_Mišák](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/petr_mi%C5%A1%C3%A1k/32/184800_2.png) [@Petr\_Mišák](https://meta.discourse.org/u/Petr_Mi%C5%A1%C3%A1k)\
**Post date:** [June 21, 2024, 6:27am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/6 "2024-06-21T06:27:29Z")

</div>

The log probably shows a record from the state when I save the article manually. Sorry it was a typo, it should have said save manually.

I thought of the DNS thing too, and did the “./launcher rebuild app” right after moving WordPress to the new server, but maybe it was too early from a DNS perspective. I’ll try again then.

---

<div class="post-metadata">

**Author:** ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)\
**Post date:** [June 21, 2024, 6:47am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/7 "2024-06-21T06:47:16Z")

</div>

Sorry, just to confirm, you mean that the log is not connected to the issue with automatic publishing you’ve reported? If not, could you share a log of an automatic publishing event?

---

<div class="post-metadata">

**Author:** ![Petr\_Mišák](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/petr_mi%C5%A1%C3%A1k/32/184800_2.png) [@Petr\_Mišák](https://meta.discourse.org/u/Petr_Mi%C5%A1%C3%A1k)\
**Post date:** [June 21, 2024, 6:56am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/8 "2024-06-21T06:56:42Z")

</div>

It is very difficult for me to tell from the log whether specific lines are related to the problem or not. I’ve made a few changes towards DNS and we’ll see if it helped when the next article comes out at 10 o’clock.

So the current problem is that when an article in WordPress is supposed to come out automatically at a certain time, the link to the Discourse community is not created. But when I subsequently edit the problematic article manually and just save it without any changes, the link to the Discourse community is created.

---

<div class="post-metadata">

**Author:** ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)\
**Post date:** [June 21, 2024, 6:59am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/9 "2024-06-21T06:59:34Z")

</div>

Next time an article goes out look for logs with `publish.INFO` or `publish.ERROR` with a similar timestamp and share what you find here.

---

<div class="post-metadata">

**Author:** ![Petr\_Mišák](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/petr_mi%C5%A1%C3%A1k/32/184800_2.png) [@Petr\_Mišák](https://meta.discourse.org/u/Petr_Mi%C5%A1%C3%A1k)\
**Post date:** [June 21, 2024, 8:09am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/10 "2024-06-21T08:09:55Z")

</div>

Currently, the automatically scheduled article [Vaše hodinky Amazfit zřejmě budou ještě lepší! Blíží se velká aktualizace](https://www.svetandroida.cz/amazfit-zepp-os-4-funkce-unik/) is out and still no link to Discourse

Which has the ID 772581

Unfortunately, all I see in the log since our last communication is this information.

```plaintext
[2024-06-21 07:09:01] connection.INFO: check_connection_status.successful_connection
[2024-06-21 07:09:01] connection.INFO: check_connection_status.valid_scopes
[2024-06-21 07:23:30] webhook_topic.INFO: update_topic_content.update_post_metadata_success {"post_ids":"772615"}
[2024-06-21 07:25:57] webhook_topic.INFO: update_topic_content.update_post_metadata_success {"post_ids":"772615"}
[2024-06-21 07:42:03] webhook_topic.INFO: update_topic_content.update_post_metadata_success {"post_ids":"772857"}
[2024-06-21 07:47:37] sso_client.INFO: auth_user.success {"user_id":129795}
[2024-06-21 07:48:05] sso_client.INFO: auth_user.success {"user_id":152766}
[2024-06-21 08:04:20] webhook_topic.INFO: update_topic_content.update_post_metadata_success {"post_ids":"772857"}

```

Here I am sending the meta log. I couldn’t read anything in it

```plaintext
### This file is included in log downloads ###

### Server ###

WordPress - 6.5.4
PHP - 8.0.30
MySQL - 11.3.2

### Active Plugins ###

Advanced Google reCAPTCHA - 1.21
Allviews - 1.0.1
APS Arena Products - 2.5.5
Classic Editor - 1.6.3
Error Log Monitor - 1.7.8
FS Poster - 6.5.9
GTM4WP - A Google Tag Manager (GTM) plugin for WordPress - 1.20.2
Head, Footer and Post Injections - 3.2.8
Kontrola uploadovaných obrázků - 1.0
Limit Modified Date - 1.0.0
Lnk.Bio - 0.2.2
Lokální ukládání Gravatarů - 1.4
Lynt Custom Functions - 1.0.3
Pixwords Scenes Nápověda - 1.0.2
Rank Math SEO PRO - 3.0.64
Rank Math SEO with AI SEO Tools - 1.0.221
Redakční Tools - bez expirace - 2.0.12
SA Partner Products Feed - 1.0
Simple Local Avatars - 2.7.10
Speculative Loading - 1.3.1
Super Progressive Web Apps - 2.2.27
SZ Ad Manager API - 1.3.21
Webpushr Push Notifications - 4.36.0
WordPress Editorial Calendar - 3.8.5
WP-Appbox - 4.4.19
WP-Discourse - 2.5.3
WP-PostViews - 1.77
Wpify Performance Helper - master
WP Shortcode by MyThemeShop - 1.4.17
WP Shortcode by MyThemeShop extend by Svět Zítřka - 1.16

### WP Discourse Settings (Secrets Excluded) ###

connection-logs - 1
display-subcategories - 0
allow-tags - 0
max-tags - 5
publish-as-unlisted - 1
full-post-content - 0
custom-excerpt-length - 55
add-featured-link - 1
auto-publish - 1
force-publish - 1
force-publish-max-age - 0
publish-failure-notice - 1
auto-track - 1
allowed_post_types - post,page
exclude_tags -
hide-discourse-name-field - 0
discourse-username-editable - 0
direct-db-publication-flags - 0
verbose-publication-logs - 1
enable-discourse-comments - 1
comment-type - display-comments-link
ajax-load - 0
load-comment-css - 0
discourse-new-tab - 0
hide-wordpress-comments - 0
show-existing-comments - 1
max-comments - 0
min-replies - 1
min-score - 0
min-trust-level - 1
bypass-trust-level-score - 50
only-show-moderator-liked - 0
custom-datetime-format -
cache-html - 1
clear-cached-comment-html - 0
verbose-comment-logs - 1
use-discourse-webhook - 1
webhook-match-old-topics - 0
use-discourse-user-webhook - 0
webhook-match-user-email - 0
verbose-webhook-logs - 1
verbose-sso-logs - 1
enable-sso - 0
auto-create-sso-user - 0
real-name-as-discourse-name - 0
force-avatar-update - 0
redirect-without-login - 0
sso-client-enabled - 1
sso-client-login-form-change - 1
sso-client-sync-by-email - 1
sso-client-disable-create-user - 0
sso-client-sync-logout - 1
logs-enabled - 1

```

---

<div class="post-metadata">

**Author:** ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)\
**Post date:** [June 21, 2024, 8:43am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/11 "2024-06-21T08:43:03Z")

</div>

Ok, so your issue is the old issue of auto-publishing with scheduled posts.

> [@Publish to Discourse and scheduling](https://meta.discourse.org/t/publish-to-discourse-and-scheduling/28043):
>
> So we have a problem when posts are created or published by other plugins, the value specified for ‘publish to discourse’ is always ignored. Discussing the issue with one author of such a plugin the response was: their plugin may be using filters that are not triggered upon an anonymous update and In some cases we aren’t able to accommodate for plugins that don’t trigger filters/actions in a global manner. Is this a possibility? Raised this on github a while back with @benword and thoug…

The most likely cause is one of your other plugins on your site is also hooking into your scheduling system, producing the issues others have seen in the past. Looking at your plugin list, this seems like a possible candidate:

> WordPress Editorial Calendar - 3.8.5

Could you try disabling that and see if the problem persists?

---

<div class="post-metadata">

**Author:** ![Petr\_Mišák](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/petr_mi%C5%A1%C3%A1k/32/184800_2.png) [@Petr\_Mišák](https://meta.discourse.org/u/Petr_Mi%C5%A1%C3%A1k)\
**Post date:** [June 21, 2024, 8:45am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/12 "2024-06-21T08:45:40Z")

</div>

Thank you for the tip. I’ve filled out the plugin, and we’ll see at 12 o’clock our time if the article comes out.

But the same plugin setup was also on the previous server, where everything worked OK.

`Warning: Undefined variable $status_url in /.../www/wp-content/plugins/wp-discourse/lib/sync-discourse-topic.php on line 230`

Which should be this piece of code `$response = $this->discourse_request( $status_url, $args );`

---

<div class="post-metadata">

**Author:** ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)\
**Post date:** [June 21, 2024, 8:49am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/13 "2024-06-21T08:49:37Z")

</div>

> [@Petr\_Mišák](#):
>
> But the same plugin setup was also on the previous server, where everything worked OK.

Are you 100% sure the setups were identical? How have you verified that?

> [@Petr\_Mišák](#):
>
> `Warning: Undefined variable $status_url in /.../www/wp-content/plugins/wp-discourse/lib/sync-discourse-topic.php on line 230`
> 
> Which should be this piece of code `$response = $this->discourse_request( $status_url, $args );`

This concerns webhooks and is unrelated to your issue.

---

<div class="post-metadata">

**Author:** ![Petr\_Mišák](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/petr_mi%C5%A1%C3%A1k/32/184800_2.png) [@Petr\_Mišák](https://meta.discourse.org/u/Petr_Mi%C5%A1%C3%A1k)\
**Post date:** [June 21, 2024, 9:21am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/14 "2024-06-21T09:21:24Z")

</div>

Yes the Discourse plugin setup was identical on the previous server, as both server and DB data was physically moved.

---

<div class="post-metadata">

**Author:** ![Petr\_Mišák](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/petr_mi%C5%A1%C3%A1k/32/184800_2.png) [@Petr\_Mišák](https://meta.discourse.org/u/Petr_Mi%C5%A1%C3%A1k)\
**Post date:** [June 21, 2024, 10:11am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/15 "2024-06-21T10:11:58Z")

</div>

So unfortunately it wasn’t this plugin. It is currently disabled and the article that just came out linking to Discourse didn’t get [Skvělý na cesty! Xiaomi vydalo maličký holicí strojek s nabíjením přes USB-C](https://www.svetandroida.cz/xiaomi-mijia-electric-shaver-cestovni-strojek/)

There is nothing in the log about the article with ID 772245

But if I open the problem article manually and save it. The following appears in the log

```plaintext
[2024-06-21 10:13:07] publish.INFO: create_post.post_success {"wp_title":"Great for travel! Xiaomi released a tiny shaver with USB-C charging","wp_author_id":"150202","wp_post_id":772245} 
[2024-06-21 10:13:07] publish.INFO: create_post.body_valid {"wp_title":"Great for travel! Xiaomi released a tiny shaver with USB-C charging","wp_author_id":"150202","wp_post_id":772245} 
[2024-06-21 10:13:07] publish.INFO: create_post.after_publish {"post_id":772245,"remote_post_type":"create_post","discourse_post_id":"10809","discourse_topic_id":"6138","discourse_permalink":"https://komunita.svetandroida.cz/t/skvely-na-cesty-xiaomi-vydalo-malicky-holici-strojek-s-nabijenim-pres-usb-c/6138"} 
[2024-06-21 10:13:07] webhook_topic.ERROR: update_topic_content.response_body_error  
[2024-06-21 10:13:07] webhook_topic.INFO: update_topic_content.update_post_metadata_success {"post_ids":"772245"} 

```

Could it be a problem that we run WP cron using WP CLI?

---

<div class="post-metadata">

**Author:** ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)\
**Post date:** [June 21, 2024, 10:23am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/16 "2024-06-21T10:23:23Z")

</div>

> [@Petr\_Mišák](#):
>
> Could it be a problem that we run WP cron using WP CLI?

Yup, that could be it. Try scheduling a post in the Wordpress UI and see if that works.

---

<div class="post-metadata">

**Author:** ![Petr\_Mišák](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/petr_mi%C5%A1%C3%A1k/32/184800_2.png) [@Petr\_Mišák](https://meta.discourse.org/u/Petr_Mi%C5%A1%C3%A1k)\
**Post date:** [June 23, 2024, 9:40am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/18 "2024-06-23T09:40:24Z")

</div>

Hmm, when we plugged in a normal cron, not just the WP CLI, everything works as it should.

But I don’t understand why this is so. Could the WordPress plugin be modified to be compatible with WP CLI as well?

Wouldn’t it help @simon

---

<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:** [June 24, 2024, 1:45am UTC](https://meta.discourse.org/t/problem-with-publishing-topic-after-moving-to-a-new-server/312064/19 "2024-06-24T01:45:18Z")

</div>

> [@Petr\_Mišák](#):
>
> Could it be a problem that we run WP cron using WP CLI?

How are you calling the cron job? Note that when you call `wp cron`, the call is affected by any global `wp` parameters: [Config – WP-CLI – WordPress.org](https://make.wordpress.org/cli/handbook/references/config/#global-parameters). It’s possible something in your `wp` config is affecting how the job is handled.

This will call all scheduled WordPress cron jobs:

```plaintext
wp cron event run --due-now

```

If you’re just calling `wp cron event run publish_future_post`, it’s possible that events that are required by the [WP Discourse](https://github.com/discourse/wp-discourse) plugin to publish a post aren’t being triggered. I _think_ this is the equivalent to how WordPress deals internally with scheduled posts:

```plaintext
wp cron event run publish_future_post future_to_publish publish_post transition_post_status

```

I haven’t tested this. I’m setting up a new computer and haven’t got WordPress site on it yet. I’ll do that soon.
