duandi4238 2018-01-29 19:08
浏览 27
已采纳

启用“帖子格式”只是为了“自定义帖子类型”而不是WordPress中的其他人

I've been struggling with Post Formats and CPTs in WordPress and after many hours, I decided to create some CPTs and enable Post Formats for them.

The problem is, when I enable Post Formats, they become available for all of the post types; and I want to have them just for some of the CPTs and not other ones.

Assume I have three CPTs called "article", "webinar" and "tutorial" . I want to enable Post Formats just for "webinar".

What I've done is to create a plugin and enable Post Formats with:

add_theme_support( 'post-formats', array( 'audio', 'image', 'video', 'gallery' ));

after that, I tried to enable them for CPT which is called medya:

add_post_type_support( 'medya', 'post-formats');

and then, I tried to disable them for defalut "post" post type.

remove_theme_support( 'post', 'post-formats');

But it doesn't work and Post Formats are enabled for both. Any suggestions?

  • 写回答

2条回答 默认 最新

  • doujiao9574 2018-02-01 07:43
    关注

    Answered

    I found the answer here.

    function remove_pf() {
        remove_meta_box( 'formatdiv','post','normal' );
    }
    add_action( 'admin_menu', 'remove_pf' );
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记