WP Manifestindependent plugin directory
manifest / content / wordpress-custom-taxonomy

Auto Assign Case Year and First Letter (Improved + Batching)

A WordPress plugin that automatically extracts years from post titles to assign a 'Case Year' taxonomy and organizes posts alphabetically. Includes a batch processor for existing content.

★ 1stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/bolade-olayode/wordpress-custom-taxonomy/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Auto Assign Case Year and First Letter (WordPress Plugin)

A lightweight WordPress utility that automatically organizes posts by analyzing their titles. Designed for legal cases, archives, or any library requiring chronological and alphabetical sorting.

Features

  • Automatic Taxonomy Assignment: Automatically detects and assigns terms to two custom taxonomies upon saving a post:
    • case_year: Extracts the year (e.g., "2024") directly from the post title.
    • first_letter: Assigns the first letter of the title (A-Z) for alphabetical indexing.
  • Smart Regex: reliably detects years (1900-2099) and handles title formatting (en-dashes, em-dashes).
  • Batch Processor: Includes a built-in tool under the "Tools" menu to process thousands of existing posts in batches to prevent server timeouts.
  • REST API Support: Registered taxonomies are visible in the WP REST API.

Installation

  1. Download the repository as a ZIP file.
  2. Go to your WordPress Dashboard > Plugins > Add New > Upload Plugin.
  3. Upload the ZIP and activate the plugin.

Usage

For New Posts

Simply write your post and publish. If the title is "State v. Doe - 2023 Appeal":

  • Case Year will be set to 2023.
  • First Letter will be set to S.

For Existing Posts (Batch Processing)

  1. Go to Tools > Assign Case Data.
  2. Click Run Next Batch.
  3. The tool will process 100 posts at a time until all content is organized.

Code Overview

  • Taxonomies: Registers case_year and first_letter.
  • Hook: Uses save_post_post to trigger on save.
  • Batching: Uses WordPress Transients to handle loop offsets/memory management.