WP Manifestindependent plugin directory
manifest / media / we-taxonomy-images

WE Taxonomy Images

Adds taxonomy images and uses them as fallback featured images and social sharing images.

by webentwicklerin, Gabriele Laesser · github.com/gbyat/we-taxonomy-images · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/gbyat/we-taxonomy-images/archive/refs/heads/main.zip

Readme

WE Taxonomy Images

Contributors: webentwicklerin
Tags: taxonomy, images, featured images, open graph, social sharing, categories
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A WordPress plugin that adds image fields to taxonomies and uses them as fallback featured images for posts and social sharing images for term archives.

Description

WE Taxonomy Images extends WordPress taxonomies (categories, tags, and custom taxonomies) with image upload functionality. The plugin automatically uses these taxonomy images as fallback featured images for posts without thumbnails and outputs them as Open Graph and Twitter images on term archive pages.

Key Features

  • Taxonomy Image Fields: Add images to any taxonomy term using the native WordPress media modal
  • Automatic Fallback: Posts without featured images automatically use taxonomy images
  • Smart Fallback Logic: Choose between deepest term first, first found, or random selection
  • Global Fallback Images: Set default images for posts and terms when no taxonomy image is available
  • Social Sharing: Automatic Open Graph and Twitter image output on term archive pages
  • Gutenberg Block: Display taxonomy images in templates using the Taxonomy Image block
  • Flexible Configuration: Enable/disable per taxonomy and customize fallback behavior

Installation

Manual Installation

  1. Download the plugin zip file
  2. Go to Plugins > Add New in your WordPress admin
  3. Click Upload Plugin
  4. Choose the zip file and click Install Now
  5. Activate the plugin

Via Git

cd wp-content/plugins
git clone https://github.com/gbyat/we-taxonomy-images.git

Then activate the plugin through the WordPress admin.

Usage

Settings

  1. Go to Settings > Taxonomy Images in your WordPress admin
  2. Enable the feature
  3. Select which taxonomies should have image fields
  4. Choose the fallback mode:
    • Deepest term first: Prefer subcategory images over parent categories
    • First found term: Use the first available taxonomy image
    • Random term: Randomly select from available taxonomy images
  5. Optionally set global fallback images for posts and terms

Adding Taxonomy Images

  1. Go to Posts > Categories (or your selected taxonomy)
  2. Edit a term or create a new one
  3. You'll see a "Taxonomy Image" field
  4. Click "Select image" to choose from the media library or upload a new image
  5. Save the term

Using Taxonomy Images

Automatic Fallback for Posts:

  • When a post has no featured image, the plugin automatically uses the taxonomy image
  • The fallback follows your configured mode (deepest, first, or random)

Social Sharing:

  • On term archive pages, the term image is automatically output as Open Graph and Twitter image
  • If no term image exists, the global term fallback image is used (if configured)

Gutenberg Block:

  • Add the "Taxonomy Image" block to your templates
  • Select a taxonomy and optionally a specific term
  • The block automatically displays the term image or uses the current post/archive context

Requirements

  • WordPress 6.0 or higher
  • PHP 7.4 or higher

Frequently Asked Questions

Does this work with custom taxonomies?

Yes! You can enable image fields for any public taxonomy, including custom taxonomies.

What happens if a post has multiple terms with images?

The plugin uses your configured fallback mode:

  • Deepest term first: Uses the most specific (deepest) term's image
  • First found term: Uses the first term that has an image
  • Random term: Randomly selects from available term images

Can I set a default image for all posts?

Yes! In the settings, you can set a "Global fallback image for posts" that will be used when no taxonomy image is available.

Does this replace existing featured images?

No. The plugin only uses taxonomy images as a fallback when a post has no featured image set. If a post has a featured image, it will always be used.

Can I use taxonomy images in my theme templates?

Yes! You can use the Gutenberg "Taxonomy Image" block, or access the image programmatically using WordPress functions like get_term_meta() with the meta key we_taxonomy_image_id.

Screenshots

  1. Settings page with taxonomy selection
  2. Term edit form with image field
  3. Taxonomy Image block in the editor
  4. Post with automatic taxonomy image fallback

Changelog

0.1.0

  • Initial release
  • Taxonomy image fields for selected taxonomies
  • Automatic fallback featured images for posts
  • Open Graph and Twitter image output for term archives
  • Global fallback images for posts and terms
  • Taxonomy Image Gutenberg block
  • Configurable fallback modes (deepest, first, random)

Development

Building

npm install
npm run build

File Structure

we-taxonomy-images/
├── build/              # Built block files
├── includes/           # PHP classes
│   ├── class-we-taxonomy-images-settings.php
│   ├── class-we-taxonomy-images-admin.php
│   ├── class-we-taxonomy-images-display.php
│   ├── class-we-taxonomy-images-helpers.php
│   └── class-we-taxonomy-images-blocks.php
├── src/                # Source files
│   └── taxonomy-image/
├── scripts/            # Build scripts
├── assets/             # Static assets
│   └── js/
└── we-taxonomy-images.php

Support

For issues, feature requests, or contributions, please visit the GitHub repository.

Credits

Author: webentwicklerin, Gabriele Laesser
Author URI: https://webentwicklerin.at

License

GPLv2 or later

Read the full README on GitHub →