开发者 | faktorvier |
---|---|
更新时间 | 2024年3月28日 22:23 |
捐献地址: | 去捐款 |
PHP版本: | 4.5.0 及以上 |
WordPress版本: | 6.5 |
版权: | GPLv2 |
版权网址: | 版权信息 |
/wp-content/plugins/f4-media-taxonomies
directory, or install the plugin through the WordPress plugins screen directlyThe built-in taxonomy category
can be enabled with this snippet. Just put it into your functions.php
:
add_action('init', function() {
register_taxonomy_for_object_type('category', 'attachment');
});
The built-in taxonomy post_tag
can be enabled with this snippet. Just put it into your functions.php
:
add_action('init', function() {
register_taxonomy_for_object_type('post_tag', 'attachment');
});
There are two ways to enable custom taxonomies for attachments:
New taxonomy:
If the taxonomy does not exist yet and you want to create a new one, you have to set the object_type in the register_taxonomy()
function to attachment
(see WordPress codex).
add_action('init', function() {
register_taxonomy(
'media-category',
'attachment'
);
});
Existing taxonomy:
If the taxonomy is already registered, you can assign it with this snippet. Just put it into your functions.php
and change media-category
to your taxonomy:
add_action('init', function() {
register_taxonomy_for_object_type('media-category', 'attachment');
});
For a better performance, we only include the scripts and files when they are needed. Some plugins can cause a problem with this functionality.
For this case we offer a hook, which allows you to enable the filter for special conditions. If this hook returns true
, the filter is enabled for the current site.
add_filter('F4/MT/Core/has_filter', function() {
return true;
});
No. We simply use the taxonomies that are registered in the code. Maybe in the future, but we want to keep this plugin as lightweight and simple as possible.
Yes, absolutely!