Automattic / Automattic/Taxonomy-Images

Add filter for enabling of taxonomies

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
21
Forks
6
PR merge metrics
No merged PRs in 30d

Description

A filter would be great that can be used to enable this plugin (featured images) for specific taxonomies.
Another plugin can then programmatically enable featured image support for specific taxonomies without the need for the user to enable these manually. A filter could be inserted into the `taxonomy_image_plugin_check_taxonomy` function:
https://github.com/Automattic/Taxonomy-Images/blob/0c4bb009820ff6db871f9e5707a7811c6f70878a/taxonomy-images.php#L1091

Edit: Current workaround using the plugin options filter (https://github.com/Automattic/Taxonomy-Images/blob/0c4bb009820ff6db871f9e5707a7811c6f70878a/taxonomy-images.php#L1101):
```php
// @see https://github.com/Automattic/Taxonomy-Images/issues/6
add_filter( 'option_taxonomy_image_plugin_settings', function( $option_value ) {
$ensure_taxonomies = [ 'my_taxonomy_slug', ];

$option_value['taxonomies'] = array_unique(
array_merge(
$option_value['taxonomies'],
$ensure_taxonomies,
),
SORT_REGULAR
);
return $option_value;
} );
````

Contributor guide

No contributing guide indexed for this repository

Research direction

Read taxonomy-images.php at taxonomy_image_plugin_check_taxonomy around line 1091, then compare the option filter at line 1101 and its documented workaround. Confirm the filter can programmatically enable featured-image support for selected taxonomies, with the existing behavior preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend, content
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.