Appearance
Database
WP Social Ninja uses a combination of custom database tables and WordPress's existing structure to store its data. The plugin creates its own tables with the wpsr_ prefix for reviews, caches, forms, and optimized images, while reusing WordPress posts/postmeta for templates and widgets and options for settings.
Database Architecture
The schema is built on top of WordPress and managed by the WPFluent framework's ORM and migration runner.
Key Features
- Custom tables — review/cache/form/image data stored under the
wpsr_prefix - WordPress integration — templates & widgets use
posts/postmeta; settings useoptions - Framework ORM — an Eloquent-like ActiveRecord layer over each table
- Migration system — version-controlled schema updates keyed to
WPSOCIALREVIEWS_DB_VERSION - Shared storage — Pro and Custom Feed for TikTok read/write these tables; they add none
Documentation Sections
Database Schema
Complete table structures, columns, indexes, and an interactive ER diagram.
Models
The ORM models for interacting with each table — retrieving, CRUD, and scopes.
Query Builder
Advanced query building with the wpsrDb() helper — wheres, joins, aggregates, and more.
Quick Start
php
use WPSocialReviews\App\Models\Review;
// Get a review by ID
$review = Review::find(123);
// Approved 5-star Google reviews, newest first
$reviews = Review::where('platform_name', 'google')
->where('review_approved', 1)
->where('rating', 5)
->orderBy('review_time', 'DESC')
->get();
// Or the query builder directly
$rows = wpsrDb()->table('wpsr_reviews')->where('rating', 5)->get();
