isotopsweden/wp-cargo

该软件包已废弃,不再维护。未建议替代软件包。

Cargo 会将内容推送到其他服务

安装数: 2,612

依赖者: 0

建议者: 0

安全性: 0

星标: 4

关注者: 2

分支: 1

开放问题: 1

类型:wordpress-muplugin

v2.0.0 2022-01-11 11:18 UTC

This package is auto-updated.

Last update: 2023-02-21 11:00:34 UTC


README

需要 PHP 7.1 和 WordPress 4.6

Cargo 会将内容推送到其他服务。如果推送失败,内容 JSON 将被保存在数据库中的队列中。

安装

composer require isotopsweden/wp-cargo

使用方法

示例配置

cargo()->set_config( [
  'content' => [
    'options' => ['siteurl', 'home']
  ],
  'database' => [
    'driver' => 'mysql',
    'mysql'  => [
      'table' => 'wp_cargo'
    ]
  ],
  'preview' => [
    'fields' => ['post_id' => 'ID', 'post_type'],
    'url'    => 'http://example.com/_preview'
  ],
  'pusher'   => [
    'driver' => 'http',
    'http'   => [
      'url' => 'https://:9988'
    ]
  ]
] );

准备元字段,以便您可以挂钩到自定义字段插件或其他内容

add_filter( 'cargo_prepare_meta_value', function ( $object_id, $slug, $value, $type ) {
  return $value;
}, 10, 4 );

在推送前修改内容数据

add_filter( 'cargo_modify_content_data', function ( $data, $type ) {
  return $data;
}, 10, 2 );

使用 WP-CLI 运行队列

wp cargo run

使用 WP-CLI 推送所有内容

wp cargo run --all

许可协议

MIT © Isotop