Skip to content
WP EngineDocumentation

Workflow

MediaPress Workflow allows you to save updates to published content without directly updating the original post until you are ready to do so.

This is achieved by creating a new draft ‘version’ of your published content, which can be worked on independently, and will override the original post when it is published.

This workflow can support various use cases. You can create an unlimited number of draft ‘versions’, work on them in isolation, decide whether or not to eventually publish them, and/or schedule them to be published in order.

This feature currently supports copy and merge of the following data:

  • Post title
  • Post excerpt
  • Post content
  • Post meta

By default, meta with the revisions_enabled argument set to true during registration will be transferred over to the draft copy (see here for more info). This is to avoid cloning inappropriate data, as revisioned meta is most likely to be related to content.

The filter wp_revisions_meta_keys can be used to adjust which meta is “revisions enabled”.

Workflow must be activated via the “MediaPress” settings page. No further configuration is necessary.

Defines the post types on which the workflow functionality will be enabled.

Default Value

[ 'post', 'page' ]

Parameters

Name Type Description
post_types array Array of post type slugs

Usage

add_filter( 'mediapress_workflow_supported_post_types', 'my_plugin_add_workflow_support' );
function my_plugin_add_workflow_support( array $post_types ): array {
$post_types[] = 'my_custom_post_type';
return $post_types;
}

Allows the adjustment of the post meta that will be cloned when a draft copy is created, and restored when a draft copy is published - overwriting the parent post values.

Parameters

Name Type Description
meta_keys array<int, string> Array of meta keys
post WP_Post The current post object

Usage

add_filter( 'mediapress_workflow_meta_keys', 'my_plugin_workflow_meta_keys' );
function my_plugin_workflow_meta_keys( array $meta_keys ): array {
if ( ! isset( $meta_keys['my_meta_key'] ) ) {
$meta_keys[] = 'my_meta_key';
}
return $meta_keys;
}

Allows the adjustment of the taxonomies that will be cloned when a draft copy is created, and restored when a draft copy is published - overwriting the parent post values.

This filter requires both the REST key and the actual taxonomy slug, since these may differ. e.g: [ 'tags' => 'post_tag' ].

Parameters

Name Type Description
taxonomies array<string, string> Array of taxonomy slugs and REST API keys [ ‘rest_key’ => ‘slug’ ]
post WP_Post The current post object

Usage

add_filter( 'mediapress_workflow_taxonomies', 'my_plugin_workflow_taxonomies' );
function my_plugin_workflow_taxonomies( array $taxonomies ): array {
if ( ! isset( $taxonomies['my_taxonomy'] ) ) {
$taxonomies['my_taxonomy'] = 'my_taxonomy';
}
return $taxonomies;
}

Whether draft copies should be completely hidden from the post list screen.

Default: false

Parameters

Name Type Description
should_hide boolean Whether to hide draft copies from the post list view

Usage

add_filter( 'mediapress_workflow_hide_draft_copies', '__return_true' );

When creating a draft ‘version’ of a post, a new post will be created with the meta key _mediapress_is_draft_copy set to true.

Posts with this meta key are excluded from queries by default so that they remain hidden from view unless specifically requested.

Draft ‘versions’ of a post have their parent set to the original post ID which is what allows us to relate them to one another.

Last updated: