WP Social Media Automation
π Premium AI-powered WordPress social media automation platform for scheduling, publishing, and managing content across multiple social networks with advanced API integrations.
by Oktay Haktan Β· github.com/oktayhaktan0/wp-social-media-otomation Β· website
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/oktayhaktan0/wp-social-media-otomation/archive/refs/heads/main.zipReadme
WP Social Media Automation
Advanced WordPress plugin for social media automation and analytics
Features
β Multi-platform Support - Facebook, Instagram, LinkedIn β Scheduled Posting - Plan content in advance with easy scheduling β Performance Analytics - Track impressions, engagements, clicks, and shares β URL Shortening - Built-in Bitly and Rebrandly integration β Best Time Recommendations - AI-powered posting time suggestions β Hashtag Analysis - Smart hashtag recommendations for better reach β React Admin Dashboard - Modern, responsive interface β REST API - Full API support for custom integrations β Cron Automation - Automatic posting and analytics updates
Requirements
- WordPress 5.8+
- PHP 7.4+
- MySQL 5.6+
- cURL extension
- JSON extension
Installation
Method 1: WordPress Admin (Recommended)
- Go to Plugins β Add New in WordPress admin
- Search for "WP Social Media Automation"
- Click Install Now and then Activate
Method 2: Manual Upload
- Download the latest release from GitHub
- Upload the plugin files to
/wp-content/plugins/wp-social-media-automationdirectory - Go to Plugins menu in WordPress admin
- Find "WP Social Media Automation" and click Activate
Method 3: Composer
composer require oktayhaktan0/wp-social-media-automation
Configuration
After activation:
- Connect Accounts: Go to Social Media β Settings and enter API keys for each platform
- Enable Platforms: Select which social networks to use
- Set Default Schedule: Configure default posting times
- Configure URL Shortener: Choose Bitly, Rebrandly, or none
- Enable Analytics: Turn on performance tracking
Usage
Scheduling Posts
From Post Editor
- Edit any WordPress post
- In the "Publish" metabox, click "Schedule Post" button
- Select platforms and schedule time
- Click "Schedule" to confirm
Using PHP API
// Schedule a post for multiple platforms
$post_id = 123;
$platforms = ['twitter', 'facebook', 'linkedin'];
$schedule_date = '2023-12-25 14:00:00';
$result = WPSMA\Core\Scheduler::schedule_post($post_id, $platforms, $schedule_date);
if ($result) {
echo 'Post scheduled successfully! ID: ' . $result;
}
Retrieving Analytics
// Get analytics for a specific post
$post_id = 123;
$analytics = WPSMA\Core\Analytics::get_post_analytics($post_id);
// Get overall analytics summary
$summary = WPSMA\Core\Analytics::get_analytics_summary();
// Display Twitter impressions
if (isset($analytics['twitter'])) {
echo 'Twitter Impressions: ' . $analytics['twitter']['impressions'];
}
Working with Platforms
// Get available platforms
$platforms = new WPSMA\Core\Platforms();
$available = $platforms->get_available_platforms();
// Get best time to post
$best_time = $platforms->get_best_time_to_post('twitter');
// Get suggested hashtags
$hashtags = $platforms->get_suggested_hashtags('My awesome blog post', 'twitter');
URL Shortening
// Shorten URL using configured service
$url = 'https://yourwebsite.com/long-url-here';
$platform = 'twitter';
// Bitly or Rebrandly will be used based on settings
$short_url = apply_filters('wpsma_shortened_url', $url, $platform);
REST API
The plugin provides a comprehensive REST API for custom integrations.
Endpoints
- POST
/wp-json/wpsma/v1/schedule-post/- Schedule a post - GET
/wp-json/wpsma/v1/scheduled-posts/- List scheduled posts - GET
/wp-json/wpsma/v1/analytics/- Get analytics data - GET
/wp-json/wpsma/v1/platforms/- List available platforms
Example: Schedule Post via REST API
curl -X POST \
https://yourwebsite.com/wp-json/wpsma/v1/schedule-post/ \
-H 'Authorization: Bearer YOUR_AUTH_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"post_id": 123,
"platforms": ["twitter", "facebook"],
"scheduled_date": "2023-12-25 14:00:00"
}'
Development
Setup
# Clone the repository
git clone https://github.com/oktayhaktan0/Wp-Social-Media-Otomation.git
cd wp-social-media-automation
# Install PHP dependencies
composer install
# Install JavaScript dependencies
npm install
# Build assets for development (watches for changes)
npm run dev
# Build assets for production
npm run build
Running Tests
# Run PHPUnit tests
composer test
# Run tests with coverage
composer test -- --coverage-html tests/coverage
# Run specific test
./vendor/bin/phpunit tests/phpunit/TestPlugin.php
Code Quality
# Run PHP CodeSniffer
composer lint
# Run ESLint
npm run lint
Architecture
Directory Structure
wp-social-media-automation/
βββ social-media-automation.php # Main plugin file
βββ includes/
β βββ class-plugin.php # Main plugin class
β βββ class-autoloader.php # PSR-4 autoloader
β βββ admin/ # Admin classes
β β βββ class-admin-admin.php # Admin functionality
β β βββ class-admin-settings.php # Settings management
β β βββ class-admin-menu.php # Menu and UI elements
β βββ core/ # Core functionality
β β βββ class-core-scheduler.php # Post scheduling
β β βββ class-core-analytics.php # Analytics tracking
β β βββ class-core-platforms.php # Platform integrations
β β βββ class-core-api.php # REST API endpoints
β βββ integrations/ # Third-party integrations
β βββ class-integrations-bitly.php # Bitly URL shortener
β βββ class-integrations-rebrandly.php # Rebrandly URL shortener
βββ assets/
β βββ js/ # JavaScript files
β β βββ admin.js # React admin app
β β βββ public.js # Public scripts
β βββ css/ # Stylesheets
β βββ admin.css # Admin styles
β βββ public.css # Public styles
βββ templates/ # Template files
β βββ scheduled-posts.php # Scheduled posts list
β βββ analytics-dashboard.php # Analytics display
β βββ post-scheduler.php # Post scheduling form
βββ tests/ # Test files
β βββ phpunit/ # PHPUnit tests
β β βββ TestPlugin.php # Plugin tests
β β βββ TestScheduler.php # Scheduler tests
β β βββ TestAnalytics.php # Analytics tests
β βββ bootstrap.php # Test bootstrap
βββ vendor/ # Composer dependencies
βββ node_modules/ # NPM dependencies
βββ .babelrc # Babel configuration
βββ composer.json # Composer config
βββ package.json # NPM config
βββ phpunit.xml # PHPUnit config
βββ webpack.config.js # Webpack config
βββ README.md # Documentation
Key Components
-
Main Plugin Class (
WPSMA\Plugin)- Initializes all components
- Handles activation/deactivation
- Sets up database tables and cron jobs
-
Scheduler (
WPSMA\Core\Scheduler)- Manages post scheduling
- Processes scheduled posts via cron
- Handles post publishing to platforms
-
Analytics (
WPSMA\Core\Analytics)- Tracks social media performance
- Updates analytics via cron
- Provides data visualization
-
Platforms (
WPSMA\Core\Platforms)- Manages social media platform integrations
- Provides best time recommendations
- Generates hashtag suggestions
-
API (
WPSMA\Core\API)- REST API endpoints
- AJAX handlers
- External API integrations
Database Schema
Tables Created
wpsma_scheduled_posts
Stores scheduled social media posts
| Column | Type | Description |
|---|---|---|
| id | bigint(20) | Primary key |
| post_id | bigint(20) | WordPress post ID |
| platforms | varchar(255) | Comma-separated platforms |
| scheduled_date | datetime | When to post |
| status | varchar(20) | pending/published/failed |
| created_at | datetime | Creation timestamp |
| updated_at | datetime | Last update timestamp |
wpsma_analytics
Tracks social media performance metrics
| Column | Type | Description |
|---|---|---|
| id | bigint(20) | Primary key |
| post_id | bigint(20) | WordPress post ID |
| platform | varchar(50) | Social media platform |
| post_date | datetime | When analytics recorded |
| impressions | bigint(20) | Number of impressions |
| engagements | bigint(20) | Number of engagements |
| clicks | bigint(20) | Number of clicks |
| shares | bigint(20) | Number of shares |
| created_at | datetime | Creation timestamp |
Cron Jobs
The plugin sets up two cron jobs:
-
wpsma_check_scheduled_posts(Hourly)- Checks for posts that should be published
- Processes pending scheduled posts
-
wpsma_update_analytics(Daily)- Fetches latest analytics from platforms
- Updates database with new metrics
Filters and Actions
Filters
wpsma_available_platforms- Modify available platformswpsma_shortened_url- Custom URL shortening logicwpsma_post_content- Modify post content before publishing
Actions
wpsma_before_post_publish- Before posting to social mediawpsma_after_post_publish- After posting to social mediawpsma_analytics_updated- When analytics are updated
Security
- All AJAX endpoints use nonce verification
- REST API requires proper authentication
- Database queries use $wpdb->prepare()
- API keys are stored securely in wp_options
- Admin functionality requires manage_options capability
Performance
- Database queries are optimized with proper indexes
- Cron jobs run at appropriate intervals
- Analytics data is cached for performance
- Asset files are minified for production
Roadmap
Future Features
- [ ] AI-powered content suggestions
- [ ] Automatic hashtag generation
- [ ] Bulk post scheduling
- [ ] Content calendar view
- [ ] Team collaboration features
- [ ] Multi-account support per platform
- [ ] Advanced analytics reporting
- [ ] Export/import functionality
Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
Bug Reports
When reporting bugs, please include:
- WordPress version
- PHP version
- Plugin version
- Steps to reproduce
- Expected vs actual behavior
- Screenshots if applicable
Feature Requests
Feature requests should include:
- Detailed description
- Use case scenario
- Potential implementation ideas
Pull Requests
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/your-feature) - Create a new Pull Request
License
This project is licensed under the GPL-2.0+ License - see the LICENSE file for details.
Support
For support, please open an issue on GitHub or contact us at support@yourwebsite.com
Changelog
See CHANGELOG.md for version history and updates.
Credits
- Lead Developer: Your Name
- Contributors: See contributors on GitHub
- Special Thanks: WordPress community, WP_Mock contributors
Donations
If you find this plugin useful, consider supporting development:
Stay Connected
- GitHub: oktayhaktan0/Wp-Social-Media-Otomation
- Website: haktanoktay.com