# Discourse Publishing Link for Custom Post Type Disappears

**URL:** https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473
**Category:** WordPress
**Created:** [January 21, 2023, 5:54am UTC](https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473 "2023-01-21T05:54:00Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![TEKFused](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tekfused/32/289343_2.png) [@TEKFused](https://meta.discourse.org/u/TEKFused)
#### Post date: [January 21, 2023, 5:54am UTC](https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473/1 "2023-01-21T05:54:01Z")

</div>

Hello,

The Discourse publish feature does create a topic for a custom post type, however, the link doesn’t appear in wp-admin. I have checked in the WordPress database under post\_meta, and the “discourse\_permalink” key for that post exists, but for some reason the link doesn’t show up.

I created the custom post type with Meta Box. This seems to be an issue with custom post types specifically. The default WP posts work fine and show the link in wp-admin.

Thank you!

Jacob Hill

---

<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: [January 21, 2023, 11:20am UTC](https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473/2 "2023-01-21T11:20:18Z")

</div>

Hey Jacob 🙂

Could you confirm a few things for me.

1. Your custom post type is selected in the [WP Discourse](https://github.com/discourse/wp-discourse) “Publishing” setting “Post Types to Publish”?

2. When you say “the link doesn’t appear in wp-admin” you mean the link is not appearing here?

---

<div class="post-metadata">

### Author: ![TEKFused](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tekfused/32/289343_2.png) [@TEKFused](https://meta.discourse.org/u/TEKFused)
#### Post date: [January 21, 2023, 5:32pm UTC](https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473/3 "2023-01-21T17:32:36Z")

</div>

Hi Angus! Yes to both of your questions.

Regarding question 2, it acts as if there was no link and allows me to publish a new post, or link to the topic. If I publish or link, result is the same - the interface from your screenshot shows no link, although it appears in the DB under post\_meta for that post.

Thanks for the help!

---

<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: [January 23, 2023, 8:49am UTC](https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473/4 "2023-01-23T08:49:29Z")

</div>

Ok, I’ll attempt to re-create this issue later this week.

In the meantime if there are any PHP logs for your instance you can share, that would be helpful. Also take a look at the [WP Discourse](https://github.com/discourse/wp-discourse) logs for any hints.

---

<div class="post-metadata">

### Author: ![TEKFused](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tekfused/32/289343_2.png) [@TEKFused](https://meta.discourse.org/u/TEKFused)
#### Post date: [January 23, 2023, 11:47pm UTC](https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473/5 "2023-01-23T23:47:39Z")

</div>

Hi @angus, thank you!

I did more research on this issue, I don’t have a solution, and there were no logs generated that I could locate. Here is the info:

After publishing the topic to Discourse, this appears in the DB for that post which looks correct.

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/4/0/d405203025d6233c7e09d9d737940db0833f6d65.png)

The topic appears in Discourse fine, but the wp-admin post edit interface acts as if this wasn’t ever done, even though the entries are in the DB:

 ![image](https://global.discourse-cdn.com/meta/original/4X/5/1/2/512a24eefbc0e62450cc8c610b3bd928662bad2c.png)

When I try linking the same post, the DB entries are updated, and I get the following message, but it shows no link after a refresh:

 ![image](https://global.discourse-cdn.com/meta/original/4X/a/e/9/ae9138baf0a54f96513102113e9ea08869d7134e.png)

After linking, the DB looks like this:

 ![image](https://global.discourse-cdn.com/meta/original/4X/a/4/3/a4340d8b75a7c27783151a4851a5ca415c8ee018.png)

I’m unsure why this isn’t working with custom post types. Like I said, it is working fine for the default posts.

Hope that helps!

Jake

---

<div class="post-metadata">

### Author: ![TEKFused](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tekfused/32/289343_2.png) [@TEKFused](https://meta.discourse.org/u/TEKFused)
#### Post date: [January 28, 2023, 3:21am UTC](https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473/6 "2023-01-28T03:21:38Z")

</div>

Hi @angus just checking in for an update on this one. 🙂 Thank you!

---

<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: [January 30, 2023, 1:52pm UTC](https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473/7 "2023-01-30T13:52:38Z")

</div>

I’m unable to recreate this at the moment. Could you send me the “metafile” in the [WP Discourse](https://github.com/discourse/wp-discourse) logs panel?

---

<div class="post-metadata">

### Author: ![TEKFused](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tekfused/32/289343_2.png) [@TEKFused](https://meta.discourse.org/u/TEKFused)
#### Post date: [January 31, 2023, 2:00am UTC](https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473/8 "2023-01-31T02:00:08Z")

</div>

Hi @angus can you tell me how to get the metafile for you?

Something interesting, the comments do show up on the front end, so the link that appears in the DB is working, however it does not show in wp-admin.

---

<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: [January 31, 2023, 7:45am UTC](https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473/9 "2023-01-31T07:45:50Z")

</div>

When you download the logs the zipped folder will include the metafile. You can PM it to me here.

Are you sure there are no logs for your Wordpress instance more broadly? My gut says that there’s some kind of exception occurring that is preventing the sidebar logic from working properly. Could you try this for me:

1. When editing a post where you see the issue occuring
2. Open your browser console ([instructions for different browsers](https://screenful.com/how-to-open-the-browser-console))
3. Reload the page and take a screenshot of any logs that appear in the browser console.

---

<div class="post-metadata">

### Author: ![TEKFused](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tekfused/32/289343_2.png) [@TEKFused](https://meta.discourse.org/u/TEKFused)
#### Post date: [February 3, 2023, 12:41am UTC](https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473/10 "2023-02-03T00:41:02Z")

</div>

Hi @angus I’m sorry for the delay, I thought you were talking about the logs in Discourse, I realize now you are wanting the WordPress plugin’s logs. 🙂

I’ve sent you the files! I actually tested disabling all plugins except for the ones below and reverting to the 2023 theme as well, and the same issue persists. No logs related to this issue, same as before.

 ![image](https://global.discourse-cdn.com/meta/original/4X/a/5/f/a5f9b59aa91c776d88db11416e990c653c8d1334.png)

It seems to be an issue related to the custom post type, perhaps specific to the CPT that is created tby MetaBox.

---

<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: [February 3, 2023, 9:09am UTC](https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473/11 "2023-02-03T09:09:32Z")

</div>

Your issue is not with the [WP Discourse](https://github.com/discourse/wp-discourse) plugin. You need to enable `custom-fields` support in the code that registers the Meta Box custom post types you’re using. The [WP Discourse](https://github.com/discourse/wp-discourse) sidebar will then work as expected.

```plaintext
your_prefix_register_post_type() {
  ...
  $args = [
     ...
     'supports' => ['title', 'editor', 'thumbnail', 'custom-fields']
  ]
}

```

---

<div class="post-metadata">

### Author: ![TEKFused](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tekfused/32/289343_2.png) [@TEKFused](https://meta.discourse.org/u/TEKFused)
#### Post date: [February 4, 2023, 1:50am UTC](https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473/12 "2023-02-04T01:50:44Z")

</div>

Hi @angus that did the trick, thanks very much!! I ticked the “Custom Fields” box in the Meta Box CPT settings, and now the link shows up in the wp-admin editor!

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/2/0/420f9c67477ff923aae5474d81794535eae73ea2.png)

Thank you very much for the help!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [March 6, 2023, 1:51am UTC](https://meta.discourse.org/t/discourse-publishing-link-for-custom-post-type-disappears/252473/13 "2023-03-06T01:51:05Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
