WP Manifestindependent plugin directory
manifest / content / mini-content-plugin

Mini Content API by Umair Arshad

A headless-ready WordPress backend architecture for micro content applications with custom post types, taxonomies, meta boxes, and optimized REST API endpoints.

★ 0stars

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/umairtipu/mini-content-plugin/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.

A headless-ready WordPress backend architecture for micro content applications. This plugin provides a custom post type "Articles" with topics taxonomy, custom meta fields, optimized REST API endpoints, and performance enhancements.

Requirements

  • WordPress 5.0+
  • PHP 7.4+
  • REST API enabled

Installation

Standard Installation

  1. Upload the mini-content-plugin folder to /wp-content/plugins/
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Go to Settings → Permalinks and click "Save Changes" to flush rewrite rules

File Structure

mini-content-plugin/
├── mini-content-plugin.php # Main plugin bootstrap
├── includes/
│ ├── cpt.php # Articles CPT registration
│ ├── taxonomy.php # Topics taxonomy registration
│ ├── meta-box.php # Article Settings meta box
│ ├── rest-api.php # REST API endpoints & caching
│ └── admin.php # Admin columns
└── readme.md # Documentation

Features Implemented

1. Custom Post Type (CPT)

  • Name: Articles (slug: hs_articles)
  • Supports: Title, Content Editor, Excerpt, Featured Images
  • Location: WordPress admin menu

2. Custom Taxonomy

  • Name: Topics (slug: hs_topics)
  • Type: Hierarchical
  • Assignment: Explicitly bound to hs_articles only

3. Custom Meta Box ("Article Settings")

  • Reading Time Field: Numeric input (minutes)
  • Featured Status Toggle: Checkbox for priority flag
  • Security: Nonce validation, capability checks, sanitization

4. REST API Endpoint

  • URL: GET /wp-json/mini/v1/articles
  • DTO Response: Clean structure with no raw database noise

5. Query Filters

  • ?topic=tech - Filter by topic slug
  • ?featured=true - Show only featured articles
  • ?page=2&per_page=20 - Pagination

6. Performance Optimizations

  • Transient Caching: 1-hour cache with automatic invalidation
  • WP_Query Optimization: no_found_rows => true eliminates SQL_CALC_FOUND_ROWS
  • Bulk Cache Deletion: Wildcard pattern for efficient invalidation

7. Security Protocols

  • Nonce validation (wp_verify_nonce)
  • Capability checks (current_user_can)
  • Context-aware escaping (esc_html, esc_url, absint)

8. Admin Improvements

  • Custom columns for Reading Time and Featured Status
  • Visual indicators for featured articles

API Usage Examples

Get all articles

curl https://yourdomain.com/wp-json/mini/v1/articles

Filter by topic

curl https://yourdomain.com/wp-json/mini/v1/articles?topic=technology

Get featured articles

curl https://yourdomain.com/wp-json/mini/v1/articles?featured=true

Combined filters with pagination

curl https://yourdomain.com/wp-json/mini/v1/articles?topic=tech&featured=true&page=1&per_page=10

Sample Response

{
  "articles": [
    {
      "id": 101,
      "title": "Optimizing Relational Post Storage",
      "excerpt": "An in-depth analysis of high-throughput transactional database states...",
      "reading_time": 6,
      "featured_image": "https://cdn.example.com/uploads/sample.jpg",
      "topics": ["Database Management", "Engineering"]
    }
  ],
  "total": 1,
  "page": 1,
  "per_page": 10
}