# 调试自定义文章类型发布为空白的问题

**URL:** <https://meta.discourse.org/t/debugging-issue-with-custom-post-type-publishing-as-blank/157750>\
**Category:** WordPress\
**Created:** [2020 年7 月 14 日 21:06 UTC](https://meta.discourse.org/t/debugging-issue-with-custom-post-type-publishing-as-blank/157750 "2020-07-14T21:06:00Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

作者： ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
发布日期： [2020 年7 月 15 日 00:30 UTC](https://meta.discourse.org/t/debugging-issue-with-custom-post-type-publishing-as-blank/157750/4 "2020-07-15T00:30:53Z")

</div>

> [@Kayla](#):
>
> 帖子会自动发布到正确的主题中，但我尝试包含在 discourse\_publish\_format\_html 中的自定义字段却显示为空。

发布帖子后，您是否在编辑器右侧的 Discourse 侧边栏中看到类似以下的提示？

 ![image](https://global.discourse-cdn.com/meta/original/3X/7/9/79f5e53937998c7d7e564e0dc6834f5bf7c29fac.png)

如果未显示“成功”消息，但帖子已发布，则问题出在自定义文章类型的配置上。

如果已显示“成功”消息，则自定义字段应作为帖子元数据可用，可通过 `get_post_meta( $post_id, 'your_meta_key_name', true );` 获取。最简单的方法是编写代码，从您的 `cosmos_custom_publish_format_html` 函数中将调试信息写入 [`debug.log`](https://wordpress.org/support/article/debugging-in-wordpress/#wp_debug_log) 文件。

我这周不在工作岗位，因此回复问题可能会比平时慢一些。

---

_[View the full topic](https://meta.discourse.org/t/debugging-issue-with-custom-post-type-publishing-as-blank/157750)._
