[英]WordPress ACF: add default rows to Repeater field type in admin section for a custom post type
The Advanced Custom Fields plugin for WordPress provides a Repeater type field. WordPress的高级自定义字段插件提供了一个Repeater类型字段。 I already know how to add rows to this via the code but what I don't know is how to get the wp-admin console for the custom post to include this code so that the dynamically added rows are shown in the editor.
我已经知道如何通过代码向此添加行,但我不知道如何让自定义帖子的wp-admin控制台包含此代码,以便在编辑器中显示动态添加的行。
So that's the question: where do I put my custom add_rows()
function if I want those rows to be visible to the editor? 所以这就是问题:如果我希望编辑器看到这些行,我在哪里放置自定义
add_rows()
函数?
Currently I have the add_rows()
code in the single page template for that custom post type.. which of course doesn't render to the editor. 目前,我在该自定义帖子类型的单页模板中有
add_rows()
代码..当然这不会呈现给编辑器。
The answer to this is twofold: 答案是双重的:
add_rows()
(which modifies the DB) for the admin section . add_rows()
(修改数据库)。 I just used a filter instead which modifies the values directly, as described in this article here: https://support.advancedcustomfields.com/forums/topic/dynamically-generate-subfield-content/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.