让WordPress多媒体文件有分类和标签

  • A+
所属分类:建站日志

给媒体文件添加分类

在functions.php中添加如下代码

//媒体分类
function ludou_create_media_category() {
  $args = array(
    'label' => '媒体分类',
    'hierarchical' => true,
    'show_admin_column' => true,
    'show_ui'      => true,
    'query_var'    => true,
    'rewrite'      => true,
  );

  register_taxonomy( 'attachment_category', 'attachment', $args );
}

add_action( 'init', 'ludou_create_media_category' );

来自:http://www.ludou.org/wordpress-applying-categories-tags-and-custom-taxonomies-to-media-attachments2.html

发表评论

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