How to Generate X (Twitter) API Token to Auto-Post to WordPress (WP Stacy Guide)

If you want to automatically publish your WordPress posts to X (formerly Twitter), you’ll need to generate API credentials from the X Developer Platform.

In this guide, you’ll learn how to create the required API keys and connect them with WP Stacy to enable fully automated posting.

πŸ“Œ What is X API Token?

The X API allows applications to interact with the platform programmatically.

To post tweets automatically, you need the following credentials:

  • API Key
  • API Secret Key
  • Access Token
  • Access Token Secret

These credentials authenticate your app and allow it to post content on your behalf.

πŸš€ Step-by-Step: Generate X API Token

🧾 Step 1: Create X Developer Account

  1. Go to the X Developer Platform
  2. Log in with your X account
  3. Apply for developer access
  4. Submit your use case and accept terms

πŸ‘‰ Approval may take some time depending on your application.

βž• Step 2: Create a Project and App

After approval:

  1. Open Developer Dashboard
  2. Click Create Project
  3. Add a new App under the project

πŸ‘‰ Your app will generate the API credentials.

βš™οΈ Step 3: Set App Permissions (Important)

Before generating tokens:

  1. Open your App settings
  2. Go to User Authentication Settings
  3. Set permissions to:

πŸ‘‰ Read and Write

⚠️ If permissions are set to “Read Only”, your app will not be able to post tweets.

πŸ”‘ Step 4: Generate API Keys and Tokens

Now go to the Keys and Tokens section inside your app.

Generate and copy:

  • API Key
  • API Secret Key
  • Access Token
  • Access Token Secret

πŸ‘‰ Save these securely β€” you may not be able to view them again later.

πŸ”„ Step 5: Regenerate Tokens (If Needed)

If something isn’t working:

  • Regenerate the Access Token and Secret
  • Update them in your plugin settings

πŸ‘‰ Old tokens will stop working after regeneration.

βš™οΈ Step 6: Connect API to WordPress (WP Stacy)

Now connect your X account to WordPress:

  1. Go to WP Stacy Settings
  2. Enter:
    • API Key
    • API Secret
    • Access Token
    • Access Token Secret
  3. Save settings

πŸ” Step 7: Enable Auto Posting

Once connected:

  • Enable Auto Post to X
  • Customize:
    • Post title format
    • Content structure
    • Hashtags

Now, every new WordPress post will automatically be shared on X.

⚠️ Common Issues & Fixes

❌ Tweets Not Posting

  • Ensure permissions are set to Read & Write
  • Regenerate access tokens

❌ 401 Unauthorized Error

  • Check API credentials carefully
  • Make sure there are no extra spaces

❌ 403 Forbidden Error

  • App permissions not configured correctly
  • Developer access may be restricted

❌ Tokens Missing

  • Go back to the β€œKeys and Tokens” section
  • Regenerate credentials

πŸ” Security Tips

  • Never share your API keys publicly
  • Store credentials securely
  • Regenerate keys if compromised

🎯 Final Thoughts

By connecting X API with WP Stacy, you can:

βœ” Automatically post content to X
βœ” Save time with full automation
βœ” Increase traffic and engagement

This setup turns your WordPress website into a powerful automated social publishing system.