当前位置: 首页 > Skill >

WordPress Remote News Publisher

WordPress Remote News Publisher

1.0.0 2026.11.08 浏览:664
获取Skill文件查看使用说明
作者:江宁许可证:
本文目录展开

Skill: WordPress Remote News Publisher

Automated news article generation and publishing to WordPress via SSH and WP-CLI.

Folder Structure

WordPress-Remote-News-Publisher/
  SKILL.md
  config.json
  scripts/
    download_cover.py
    optimize_image.sh
    upload_media_remote.sh
    publish_wp_remote.sh

Metadata

---
name: wordpress-remote-news-publisher
description: |
  Automatically generates and publishes news articles to a remote WordPress 
  installation via SSH using public key authentication. Downloads and optimizes 
  cover images from Unsplash, transfers them via SCP, and publishes articles 
  with SEO metadata (Yoast).
user-invocable: true
triggers:
  - cron: "0 10 * * 1-5"  # Weekdays at 10:00
  - cron: "0 16 * * 1-5"  # Weekdays at 16:00
  - manual: "/wordpress-remote-news-publisher [topic]"
metadata:
  emoji: "📰"
  version: "1.0.0"
  author: "ClawHub Community"
  license: "MIT"
  openclaw:
    requires:
      bins:
        - ssh
        - scp
        - python3
        - curl
        - convert
      env:
        - WP_SSH_HOST
        - WP_SSH_USER
        - WP_SSH_KEY
        - WP_SSH_PORT
        - WP_REMOTE_PATH
        - WP_REMOTE_TMP
        - WP_AUTHOR_ID
        - UNSPLASH_ACCESS_KEY
---

Overview

This skill enables automated news content creation and publication to WordPress websites hosted on remote servers. It leverages SSH with public key authentication for secure, passwordless connections, and WP-CLI for all WordPress operations on the server side.

Key Features

  • Remote Execution: All WP-CLI operations run on the remote server via SSH
  • Automated Topic Selection: Round-robin rotation through configured topics
  • Journalistic Writing Style: Senior journalist quality content with lede, body, and attribution
  • Image Pipeline: Unsplash download → local optimization → SCP transfer → WordPress import
  • SEO Integration: Yoast SEO meta description and focus keyword support
  • Cron Scheduling: Automated execution on weekdays

Required Environment Variables

Variable Description Required Example
WP_SSH_HOST Remote server hostname or IP Yes 203.0.113.10 or example.com
WP_SSH_USER SSH username on remote server Yes deploy, www-data, wpcli
WP_SSH_KEY Absolute path to SSH private key Yes /home/user/.ssh/id_ed25519_wp
WP_SSH_PORT SSH port (default: 22) No 22
WP_REMOTE_PATH Absolute path to WordPress installation Yes /var/www/html/wordpress
WP_REMOTE_TMP Writable temp directory on remote No /tmp
WP_AUTHOR_ID WordPress author ID for posts Yes 1
UNSPLASH_ACCESS_KEY Unsplash API access key Yes AbC123...

Editorial Philosophy

Every article MUST adhere to these rules:

  1. Write like a senior journalist, not an AI assistant
  2. Use variable sentence length: Alternate short periods with complex constructions
  3. Lead with a clear thesis in the first paragraph (lede)
  4. Include attributed quotes from real sources when available
  5. Avoid AI-sounding phrases: Never use "it's important to note," "in the digital age," "in today's world," "in conclusion," "obviously," "clearly," or similar formulas
  6. Specific titles: No clickbait. The title must contain the main fact

Complete Procedure

Phase 1: Topic Selection

If no topic is provided as argument:

  1. Read config.json for the configured topic list
  2. Select the topic with the oldest publication date (round-robin)
  3. Use that topic for content generation

Phase 2: SSH Connection Verification

Before any operation, verify SSH connectivity:

ssh -i "$WP_SSH_KEY" -p "${WP_SSH_PORT:-22}" 
    -o StrictHostKeyChecking=no 
    -o BatchMode=yes 
    -o ConnectTimeout=10 
    "$WP_SSH_USER@$WP_SSH_HOST" 
    "wp --info --path=$WP_REMOTE_PATH"

If this fails, abort and notify via Telegram with error details.

Phase 3: Research and Fact Gathering

  1. Web Search: Query "[topic] latest news [current month]" and English equivalents for international sources

  2. Fact Collection (only verifiable facts):

    • Numerical data with source attribution
    • Statements from real people with name and role
    • Specific dates and events
    • Avoid unattributed speculation
  3. Store Facts: Save to /tmp/wp_facts.json

Phase 4: Article Generation

Mandatory Editorial Structure

TITLE (max 65 characters)

  • Specific, not generic. Contains the main fact.
  • ✅ Good: "Meta cuts 3,600 jobs: farewell to Base AI teams"
  • ❌ Bad: "Meta takes important step for the future"

LEDE (first paragraph, 40-60 words)

  • Answers: Who? What? When? Where? Why?
  • The most important news in dense, precise form
  • Never starts with "In the world of..." or "In recent years..."

BODY (600-900 total words)

  • Paragraph 2: Context and background
  • Paragraphs 3-4: Main development with data and citations
  • Paragraph 5: Reactions and positions from key players
  • Paragraph 6: Implications and prospects (attributed to experts)
  • Final paragraph: Narrative closing element

META DESCRIPTION (max 155 characters) SEO TAGS (3-5 tags, without #) PRIMARY KEYWORD (1 keyword)

Output Format

Save to /tmp/wp_article.json:

{
  "title": "...",
  "content": "...",
  "excerpt": "...",
  "tags": ["..."],
  "meta_desc": "...",
  "keyword": "...",
  "topic": "..."
}

Phase 5: Cover Image

  1. Determine Visual Keyword: Derive from article topic (e.g., "server room technology")

  2. Download from Unsplash (local machine):

    python3 {baseDir}/scripts/download_cover.py '[keyword]' /tmp/cover.jpg
    
  3. Optimize Locally:

    bash {baseDir}/scripts/optimize_image.sh /tmp/cover.jpg /tmp/cover_opt.jpg
    
  4. Transfer and Import:

    bash {baseDir}/scripts/upload_media_remote.sh /tmp/cover_opt.jpg
    

    → Media ID saved to /tmp/wp_media_id.txt

Phase 6: Publishing to Remote WordPress

  1. Create Draft Post:

    bash {baseDir}/scripts/publish_wp_remote.sh
    
  2. Verify Status: Wait 30 seconds, check via SSH

  3. Publish:

    ssh -i "$WP_SSH_KEY" -p "${WP_SSH_PORT:-22}" "$WP_SSH_USER@$WP_SSH_HOST" 
      "wp post update $(cat /tmp/wp_post_id.txt) 
       --post_status=publish --path=$WP_REMOTE_PATH"
    
  4. Retrieve Published URL:

    ssh -i "$WP_SSH_KEY" -p "${WP_SSH_PORT:-22}" "$WP_SSH_USER@$WP_SSH_HOST" 
      "wp post get $(cat /tmp/wp_post_id.txt) --field=url --path=$WP_REMOTE_PATH"
    
  5. Send Telegram Confirmation: Title, URL, word count, keyword

Phase 7: Update Registry

Update config.json with the current timestamp for the published topic to ensure proper rotation.

SSH Key Setup (One-Time)

Before using this skill, configure public key authentication:

# 1. Generate a dedicated key pair (ed25519 recommended)
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_wp 
    -C "openclaw-wp-publisher" -N ""

# 2. Copy public key to remote server
ssh-copy-id -i ~/.ssh/id_ed25519_wp.pub -p 22 deploy@203.0.113.10

# 3. Verify passwordless connection
ssh -i ~/.ssh/id_ed25519_wp -o BatchMode=yes 
    deploy@203.0.113.10 "wp --info"

# 4. (Optional) Restrict key in ~/.ssh/authorized_keys
command="wp --allow-root",no-port-forwarding,no-X11-forwarding 
    ssh-ed25519 AAAA... openclaw-wp-publisher

Security Tip: Use a dedicated SSH user (deploy or wpcli) with minimal server permissions. Never use root. If WP-CLI needs write access to /var/www, add the user to the www-data group.

Remote Server Requirements

Component Requirement Verification
WP-CLI Installed and in PATH wp --info
PHP ≥ 7.4 (8.x recommended) php --version
Python 3 For JSON parsing python3 --version
Permissions SSH user writes to WP_REMOTE_PATH ls -la /var/www/html/wordpress
SSH Port Open in firewall ufw status

Local Machine Requirements (OpenClaw)

Component Requirement Installation
ssh, scp In PATH Pre-installed on Linux/macOS
ImageMagick convert command apt install imagemagick
Python 3 With requests library pip install requests

Configuration Example

OpenClaw Configuration

Add to ~/.openclaw/openclaw.json:

{
  "skills": {
    "entries": {
      "wordpress-remote-news-publisher": {
        "env": {
          "WP_SSH_HOST": "203.0.113.10",
          "WP_SSH_USER": "deploy",
          "WP_SSH_KEY": "/home/user/.ssh/id_ed25519_wp",
          "WP_SSH_PORT": "22",
          "WP_REMOTE_PATH": "/var/www/html/wordpress",
          "WP_REMOTE_TMP": "/tmp",
          "WP_AUTHOR_ID": "1",
          "UNSPLASH_ACCESS_KEY": "your-unsplash-access-key"
        }
      }
    }
  },
  "cron": {
    "jobs": [
      {
        "id": "wp-morning-news",
        "schedule": "0 10 * * 1-5",
        "prompt": "Execute wordpress-remote-news-publisher. Select topic from rotation.",
        "channel": "telegram"
      },
      {
        "id": "wp-afternoon-news",
        "schedule": "0 16 * * 1-5",
        "prompt": "Execute wordpress-remote-news-publisher for afternoon edition.",
        "channel": "telegram"
      }
    ]
  }
}

Summary

This skill enables fully automated WordPress publishing without requiring WP-CLI on the local machine. All WordPress operations execute remotely via SSH, images process locally and transfer via SCP, and the connection uses public key authentication for security and automation.

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,031
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,029
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,017
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,014
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,011
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,011
Skill 文件
  • SKILL.md
    • Skill: WordPress Remote News Publisher
    • Folder Structure
    • Metadata
    • Overview
      • Key Features
    • Required Environment Variables
    • Editorial Philosophy
    • Complete Procedure
      • Phase 1: Topic Selection
      • Phase 2: SSH Connection Verification
      • Phase 3: Research and Fact Gathering
      • Phase 4: Article Generation
        • Mandatory Editorial Structure
        • Output Format
      • Phase 5: Cover Image
      • Phase 6: Publishing to Remote WordPress
      • Phase 7: Update Registry
    • SSH Key Setup (One-Time)
    • Remote Server Requirements
    • Local Machine Requirements (OpenClaw)
    • Configuration Example
      • OpenClaw Configuration
    • Summary
  • 项目或源文件

相关 Skill

更多
Wordpress AEO Autoblogger Wordpress AEO Autoblogger 自主AEO与SEO内容生成与优化引擎,用于规模化业务运营。适用于Codex需执行端到端程序化SEO的场景。
WordPress REST API CLI WordPress REST API CLI OpenClaw 技能,提供 WordPress REST API 命令行接口,用于文章、页面、分类、标签、用户及自定义请求,使用纯 HTTP。
wordpress-ultimate wordpress-ultimate Three env vars. One script. Your agent manages your entire WordPress site — draft-only safety included.
Develop and harden WordPress plugins with lifecycle and security guardrails Develop and harden WordPress plugins with lifecycle and security guardrails 当代理需要构建、重构、保护或打包具有正确激活钩子、设置处理、卸载行为和数据卫生的WordPress插件时,请使用Automattic官方wp-plugin-development技能。这是一个插件工程手册,而不是通用的WordPress列表。
WordPress MCP WordPress MCP 通过AI Engine的MCP(模型上下文协议)管理WordPress网站。用于创建/编辑文章、SEO分析、数据分析、媒体管理、分类操作、社媒排程、多语言内容(Polylang)及任何WordPress管理任务。需安装免费AI Engine插件并启用MCP服务器。适用于WordPress网站管理、内容工作流或WP相关任务。