我一直在努力学习如何编写插件,我认为最好的方法是查看其他插件。
我在看这一行和第一行
/**
* Plugin Name: Media Library Categories
* Plugin URI: http://wordpress.org/plugins/wp-media-library-categories/
* Description: Adds the ability to use categories in the media library.
* Version: 1.4.1
* Author: Jeffrey-WP
* Author URI: http://codecanyon.net/user/jeffrey-wp/?ref=jeffrey-wp
*/
/** register taxonomy for attachments */
function wpmediacategory_init() {
// Default taxonomy
$taxonomy = \'category\';
// Add filter to change the default taxonomy
$taxonomy = apply_filters( \'wpmediacategory_taxonomy\', $taxonomy );
register_taxonomy_for_object_type( $taxonomy, \'attachment\' );
}
add_action( \'init\', \'wpmediacategory_init\' );
有一行:$taxonomy = apply_filters( \'wpmediacategory_taxonomy\', $taxonomy
我不明白。我查看了Wordpress文档,没有找到一个名为wpmediacategory_taxonomy
. 除了名字之外,我相信这与插件有关。那么它到底是如何工作的呢?那是定制挂钩吗?它是在哪里定义的?