给WordPress多媒体文件添加分类

  • A+
所属分类:资源分享

给多媒体添加分类,便于文件区分管理,使用方法,在当前主题的functions.php中添加php代码:

  1. function ludou_create_media_category() {
  2. $args = array(
  3. 'label' => '媒体分类',
  4. 'hierarchical' => true,
  5. 'show_admin_column' => true,
  6. 'show_ui' => true,
  7. 'query_var' => true,
  8. 'rewrite' => true,
  9. );
  10. register_taxonomy( 'attachment_category', 'attachment', $args );
  11. }
  12. add_action( 'init', 'ludou_create_media_category' );

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: