Batch Post
Tags: showdev, webdev, wordpress
Published: 2018-02-09 20:10:50

---
title: Batch Post
published: true
description: A WordPress plugin to create batches of posts from a template.
tags: showdev, webdev, wordpress
cover_image: https://foresthoffman.com/wp-content/uploads/2018/02/batchpost-banner_2.jpg
---

The Batch Post WordPress plugin gives authors the ability to generate numerous posts from a template post. Using the plugin's custom shortcode, portions of both the title and the body of the template post can be indicated as content that should change through the generation process.

On a regular basis, [Rob Schwartz](https://acatestprep.com/) needs to create a set of 10-50 posts with a little variance between each post. This is quite tedious to do manually, and that's where the Batch Post plugin comes into play! Using Batch Post, Rob can create a template, indicate where he'd like the title and content to change, specify any meta data (categories, tags, etc.) that should be applied to the batch, and create as many posts as he needs.

The batch creation process also saves time by overriding the previous batch's posts as needed. That is, if the batch is going to create posts that already exist, they will be deleted and re-created. The posts' slugs are compared to prevent permalink issues.

When a batch is being created, the template post is parsed for instances of the `bpauto` shortcode. The shortcode itself can be used in two ways:

1. Default, e.g. `[bpauto]`
2. With an offset, e.g. `[bpauto offset=1]`

The offset argument for the shortcode accepts either a positive or negative offset to the number given to each post based on it's position in the batch.

If the batch template has a post title of `ID15-1[bpauto]` and the batch size is equal to `5`, the result would be:

![Post Title Example](https://foresthoffman.com/wp-content/uploads/2018/02/batchpost-template-title.png "example of post title using shortcode")

![Metabox Example](https://foresthoffman.com/wp-content/uploads/2018/02/batchpost-metabox.png "example of Batch Post meta box")

Alternatively, if the batch template's post title was `ID15-1[bpauto offset=1]`, a batch of `5`, the result would be:

![Post Title Example](https://foresthoffman.com/wp-content/uploads/2018/02/batchpost-template-title-2.png "example of post title using shortcode with an offset")

![Metabox Example](https://foresthoffman.com/wp-content/uploads/2018/02/batchpost-metabox-2.png "example of Batch Post meta box with an offset")

With a unique choice of template title, the batch posts can be linked to each other. For example, consider this post template:

Post Title
> ID15-1`[bpauto]`

Post Body 
> &lt;video src=&quot;example.com/wp-content/uploads/2018/02/id15-1`[bpauto]`.mp4&quot;&gt;&lt;/video&gt;
> 
> &lt;a href=&quot;example.com/id15-1`[bpauto offset=1]`&quot;&gt;&lt;button&gt;Next Video&lt;/button&gt;&lt;/a&gt;

This template is using both the default form of the shortcode as well as providing an offset (+1).

With a batch size of `5`, the above template will generate the following for the first post:

Post Title
> ID15-1`01`

Post Body
> &lt;video src=&quot;example.com/wp-content/uploads/2018/02/id15-1`01`.mp4&quot;&gt;&lt;/video&gt;
> 
> &lt;a href=&quot;example.com/id15-1`02`&quot;&gt;&lt;button&gt;Next Video&lt;/button&gt;&lt;/a&gt;

...and for the second:

Post Title
> ID15-1`02`

Post Body
> &lt;video src=&quot;example.com/wp-content/uploads/2018/02/id15-1`02`.mp4&quot;&gt;&lt;/video&gt;
> 
> &lt;a href=&quot;example.com/id15-1`03`&quot;&gt;&lt;button&gt;Next Video&lt;/button&gt;&lt;/a&gt;

...and so on.