简体   繁体   English

如何使用可选字段创建WordPress自定义帖子类型

[英]How To Create WordPress Custom Post Type With OPTIONAL Fields

When creating a custom post type in wordpress for dynamic items, such as portfolio items, some fields may be unsable for certain portfolio items. 在Wordpress中为动态项目(例如投资组合项目)创建自定义帖子类型时,某些字段对于某些投资组合项目可能无法使用。 But, if you leave this field out, there will be a validation error in wordpress, because the field is a necessary according to WordPress. 但是,如果您将此字段保留为空白,则WordPress中会出现验证错误,因为根据WordPress,该字段是必需的。 How can someone make certain fields in the custom post type optional? 有人如何使自定义帖子类型中的某些字段可选? So no validation errors occur? 所以没有验证错误发生?

To make the field optional, simply go to admin dashboard, scroll down the left navigation panel and click Custom Fields. 要使该字段为可选字段,只需转到管理信息中心,向下滚动左导航面板,然后单击“自定义字段”。 Then, click on the post type you'd like to edit. 然后,点击您要编辑的帖子类型。 Click on a field you want to make optional, and you will see a check box for yes or no -- click no. 单击要设置为可选的字段,您将看到一个是或否的复选框-单击否。 Click Update. 单击更新。 The field will no longer be required! 不再需要该字段!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM