Database Schema
This content is intended for WordPress developers, and it may require coding knowledge of WordPress, PHP, and JavaScript. Code examples provided here may contain errors or needs some additional coding. Make sure to test the code before using it on a live website!
coreSocial Lite and Pro use three plugin tables. These are technical descriptions for integrations and database maintenance, not SQL installation instructions. Let the plugin’s installation/update process manage the schema.
Table prefix and ownership
The examples use wp_ for readability. Actual names use the current WordPress site’s table prefix, including the appropriate site prefix in multisite. Charset, collation, and database configuration follow the installation environment. Do not hard-code the sample prefix in an integration.
An item ID in these tables is the plugin’s tracking registration ID. It is not the WordPress post or term ID stored in the item record. For a custom URL, the WordPress item ID is zero and the URL hash identifies the registration.
Items
CREATE TABLE `wp_coresocial_items` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`item` VARCHAR(16) NOT NULL DEFAULT 'post',
`item_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
`item_hash` VARCHAR(32) NOT NULL DEFAULT '',
`url` VARCHAR(1024) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `item` (`item`) USING BTREE,
INDEX `item_id` (`item_id`) USING BTREE,
INDEX `item_hash` (`item_hash`) USING BTREE
);
Log
CREATE TABLE `wp_coresocial_log` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`item_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
`user_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
`user_hash` VARCHAR(32) NOT NULL DEFAULT '',
`network` VARCHAR(64) NOT NULL DEFAULT '',
`action` VARCHAR(64) NOT NULL DEFAULT 'share',
`module` VARCHAR(64) NOT NULL DEFAULT 'inline',
`logged` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `network` (`network`) USING BTREE,
INDEX `item_id` (`item_id`) USING BTREE,
INDEX `user_id` (`user_id`) USING BTREE,
INDEX `user_hash` (`user_hash`) USING BTREE,
INDEX `action` (`action`) USING BTREE,
INDEX `module` (`module`) USING BTREE,
INDEX `logged` (`logged`) USING BTREE
);
Counts
CREATE TABLE `wp_coresocial_counts` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`item_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
`network` VARCHAR(64) NOT NULL DEFAULT '',
`internal` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
`online` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
`updated` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `item_id_network` (`item_id`, `network`) USING BTREE,
INDEX `item_id` (`item_id`) USING BTREE,
INDEX `network` (`network`) USING BTREE,
INDEX `updated` (`updated`) USING BTREE
);
How activity is stored
Items identify what is tracked. Counts store aggregate internal and externally retrieved values per item/network; the item/network pair is unique. The log stores Like records and, when activity logging is enabled, individual share and Explore actions. Explore activity uses the same tables with its provider/module/action values, while reporting separates AI clicks from social shares.
coreSocial uses log rows to detect repeat Likes by a WordPress user ID or an optional visitor IP hash.
For meaning and lifecycle, read Counts and Logging. Before changing data, review Shared Items, Share Logs, and Tools. Use the Developer Guide for supported extension points rather than treating direct writes to these tables as a general API.