admin管理员组文章数量:1122846
I'm creating a new custom post type. But I need to limit the max length for the title. This is how I'm creating the field in my code:
array(
'key' => 'title',
'label' => 'Title',
'name' => 'title',
'type' => 'text',
'required' => 1,
'maxlength' => 65,
)
But the maxlength property isn't working. Is there a way to set this limit from code (not using a plugin) and only for this post type?
I'm creating a new custom post type. But I need to limit the max length for the title. This is how I'm creating the field in my code:
array(
'key' => 'title',
'label' => 'Title',
'name' => 'title',
'type' => 'text',
'required' => 1,
'maxlength' => 65,
)
But the maxlength property isn't working. Is there a way to set this limit from code (not using a plugin) and only for this post type?
Share Improve this question asked Mar 4, 2021 at 14:20 Santiago Mendoza RamirezSantiago Mendoza Ramirez 1113 bronze badges 1- Just build your CPT as you normally would then apply the following filter to it afterwards: wordpress.org/support/topic/… – Tony Djukic Commented Mar 5, 2021 at 17:19
1 Answer
Reset to default 0array(
'key' => 'custom_post_title',
'label' => 'Title',
'name' => 'title',
'type' => 'text',
'required_over' => 1,
'maxlength_set' => 65,
)
本文标签: Set a maxlength for the title input in a custom post type
版权声明:本文标题:Set a maxlength for the title input in a custom post type 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736305801a1932719.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论