WP Manifestindependent plugin directory
manifest / social / wp-social-media-otomation

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

β˜… 0stars
0forks

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.zip

Readme

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)

  1. Go to Plugins β†’ Add New in WordPress admin
  2. Search for "WP Social Media Automation"
  3. Click Install Now and then Activate

Method 2: Manual Upload

  1. Download the latest release from GitHub
  2. Upload the plugin files to /wp-content/plugins/wp-social-media-automation directory
  3. Go to Plugins menu in WordPress admin
  4. Find "WP Social Media Automation" and click Activate

Method 3: Composer

composer require oktayhaktan0/wp-social-media-automation

Configuration

After activation:

  1. Connect Accounts: Go to Social Media β†’ Settings and enter API keys for each platform
  2. Enable Platforms: Select which social networks to use
  3. Set Default Schedule: Configure default posting times
  4. Configure URL Shortener: Choose Bitly, Rebrandly, or none
  5. Enable Analytics: Turn on performance tracking

Usage

Scheduling Posts

From Post Editor

  1. Edit any WordPress post
  2. In the "Publish" metabox, click "Schedule Post" button
  3. Select platforms and schedule time
  4. 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

  1. Main Plugin Class (WPSMA\Plugin)

    • Initializes all components
    • Handles activation/deactivation
    • Sets up database tables and cron jobs
  2. Scheduler (WPSMA\Core\Scheduler)

    • Manages post scheduling
    • Processes scheduled posts via cron
    • Handles post publishing to platforms
  3. Analytics (WPSMA\Core\Analytics)

    • Tracks social media performance
    • Updates analytics via cron
    • Provides data visualization
  4. Platforms (WPSMA\Core\Platforms)

    • Manages social media platform integrations
    • Provides best time recommendations
    • Generates hashtag suggestions
  5. 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:

  1. wpsma_check_scheduled_posts (Hourly)

    • Checks for posts that should be published
    • Processes pending scheduled posts
  2. wpsma_update_analytics (Daily)

    • Fetches latest analytics from platforms
    • Updates database with new metrics

Filters and Actions

Filters

  • wpsma_available_platforms - Modify available platforms
  • wpsma_shortened_url - Custom URL shortening logic
  • wpsma_post_content - Modify post content before publishing

Actions

  • wpsma_before_post_publish - Before posting to social media
  • wpsma_after_post_publish - After posting to social media
  • wpsma_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

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -am 'Add new feature')
  4. Push to the branch (git push origin feature/your-feature)
  5. 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

Donations

If you find this plugin useful, consider supporting development:

Stay Connected

Read the full README on GitHub →