admin管理员组文章数量:1302318
Which hooks can I use to add my own HTML stuff to a CPT edit screen? I created an own CPT with
$args = array (
'labels' => array (
'name' => 'Catalog',
),
'capability_type' => 'post',
'has_archive' => true,
'public' => true,
'show_in_menu' => true,
'rewrite' => array (
'slug' => 'catalog'
),
'supports' => array (
'title',
'thumbnail'
),
);
register_post_type( 'catalog', $args );
I use only the featured image for the rest I removed all default things like title editor... You can see this in the support array in my code above.
Now I want add my own HTML stuff to this editpage
Which hooks can I use to add my own HTML stuff to a CPT edit screen? I created an own CPT with
$args = array (
'labels' => array (
'name' => 'Catalog',
),
'capability_type' => 'post',
'has_archive' => true,
'public' => true,
'show_in_menu' => true,
'rewrite' => array (
'slug' => 'catalog'
),
'supports' => array (
'title',
'thumbnail'
),
);
register_post_type( 'catalog', $args );
I use only the featured image for the rest I removed all default things like title editor... You can see this in the support array in my code above.
Now I want add my own HTML stuff to this editpage
Share Improve this question edited Mar 20, 2021 at 19:10 Jop asked Mar 19, 2021 at 23:16 JopJop 1279 bronze badges 5- are you referring to the classic editor or the block editor? – Tom J Nowell ♦ Commented Mar 19, 2021 at 23:40
- @TomJNowell the classic editor – Jop Commented Mar 19, 2021 at 23:41
- What exactly are you trying to do that requires this? What's the context? – Tom J Nowell ♦ Commented Mar 20, 2021 at 12:44
- With my own HTML I have more control. I want create my own form and I don't need the default input fields. I thought it was easy to do just like a calback page for add_admin_menu. – Jop Commented Mar 20, 2021 at 18:41
- So you don't just want to add things, you want to remove things too? I ask this because there are multiple hooks and filters, but which one to use depends on what you want to do. By keeping your answer as generic as possible you make the question much harder to answer. People answering would have to write a comprehensive answer that covers every possible use case for every possible situation, which could take hours. Add more context and be more specific in your question, state what you are trying to replace, and what you're replacing it with – Tom J Nowell ♦ Commented Mar 20, 2021 at 18:52
1 Answer
Reset to default 0I found a solution
add_action('edit_form_advanced', 'add_to_admin_cpt');
function add_to_admin_cpt() {
global $post;
if ($post->post_type == 'catalog') {
//doing my own stuff
}
}
本文标签: custom post typesAdd html tot CPT edit screenno metabox
版权声明:本文标题:custom post types - Add html tot CPT edit screen - no metabox 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741664722a2391240.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论