WordPress Plugin

WP-CLI

Using WP-CLI for reposting and bulk publishing to social media.

Information Icon

We’re still creating our videos and documentation, so some pages may be missing information. Please open a support request for any queries not answered here, and check back for videos and updated documentation soon.

If your web host has WP-CLI installed, you can run the following commands at the command line:

Repost

Runs the Repost command, behaving as if WordPress’ Cron ran the Repost event.

Information Icon

Posts, or their Post Types, must have Repost Status(es) defined to be eligible for posting.

Alert Icon

By default, the Repost WordPress Cron Event will run daily.  If you prefer to use WP-CLI, either automatically or manually, you’ll want to disable the scheduled WordPress Cron Event to prevent duplicate reposting. Refer to the Repost Settings Documentation to disable the scheduled WordPress Cron Event.

wp social-post-flow-repost --post_types=

ParameterDescription
--post_types=Optional; one or more Post Types to Repost (Post Types must have Repost Status(es) defined).
--post_types=post: Posts
--post_types=post,page: Posts and Pages
--test_modeOptional; if specified, Reposting will dryrun, meaning that statuses are not sent.  The results are displayed in the console and (if enabled) in the Log.

Bulk Publish

Runs the Bulk Publish command, behaving as if the user has selected WordPress Posts through the Bulk Publish functionality.

Information Icon

Posts, or their Post Types, must have Bulk Publish Status(es) defined to be eligible for posting.

This command can be used in one of two ways:

  • Defining the Posts to Bulk Publish, using Post IDs, or
  • Defining query parameters to select Posts to Bulk Publish – for example, all Posts belonging to a given Category, or published within a date range.

Defining Specific Posts

To send specific Posts via Bulk Publishing, use:

wp social-post-flow-bulk-publish --ids=1,2

ParameterAccepted Value(s)Description
--ids=stringOne or more Post IDs to Bulk Publish.  If defined, no other parameters are required.
--ids=1,2: Bulk Publish Post IDs 1 and 2
--test_modenoneOptional; if specified, Bulk Publishing will dryrun, meaning that statuses are not sent.  The results are displayed in the console and (if enabled) in the Log.

Defining Query Parameters

To send Posts via Bulk Publishing based on query parameters – for example, all Posts belonging to a given Category, or published within a date range – use:

wp social-post-flow-bulk-publish --post_type=post --start_date=...

ParameterAccepted Value(s)Description
--post_type=stringSend Posts belonging to the given Post Type
--start_date=yyyy-mm-ddSend Posts published on or after the given Start Date.
--end_date=yyyy-mm-ddSend Posts published on or before the given End Date.
--authors=integersSend Posts belonging to the given Author ID(s).
--authors=1,2: Bulk Publish Posts where the Author is User ID 1 or 2
--meta_key=stringSend Posts that meet the given Post Meta condition, comprising of the Meta Key, Value and Compare options
--meta_value=stringSend Posts that meet the given Post Meta condition, comprising of the Meta Key, Value and Compare options
--meta_compare==
!=
>
>=
<
<=
LIKE
NOT LIKE
EMPTY
NOT EMPTY
Send Posts that meet the given Post Meta condition, comprising of the Meta Key, Value and Compare options.

--meta_key=example_key --meta_value=1 --meta_compare==: Bulk Publish Posts where the Post has a Meta Key of example_key, with its value equalling 1.

--meta_key=example_key --meta_value=1 --meta_compare=!=: Bulk Publish Posts where the Post has a Meta Key of example_key, with its value not equalling 1.
--s=stringSend Posts that contain the given search term(s).
--category=integersSend Posts assigned to the given Category Term ID(s).
--category=1,2: Bulk Publish Posts where the Post’s Category matches Term ID 1 or Term ID 2.
--post_tag=integersSend Posts assigned to the given Post Tag Term ID(s).
--post_tag=1,2: Bulk Publish Posts where the Post’s Post Tag matches Term ID 1 or Term ID 2.
--orderby=none
ID
author
title
name
type
date
modified
rand
comment_count
relevance
Defines the order to Bulk Publish Posts found using the above conditions.
--order=asc
desc
Defines the order to Bulk Publish Posts found using the above conditions.
--test_modenoneOptional; if specified, Bulk Publishing will dryrun, meaning that statuses are not sent.  The results are displayed in the console and (if enabled) in the Log.
Information Icon

Custom Taxonomies are also supported. Use the same syntax as for Categories and Post Tags, ensuring you use the programmatic name of the Custom Taxonomy.  For example, a Custom Taxonomy registered with the programmatic name of location would use the syntax --location=1,2


Published

Last Updated