=== PlanBatch ===
Contributors: siaccslv
Tags: auto post, social media, instagram, bluesky, woocommerce
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.12
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Auto-share new posts to Instagram, Facebook, Bluesky, LinkedIn profiles and Pinterest, and drip-schedule old posts and products.

== Description ==

PlanBatch shares your WordPress posts and WooCommerce products to Instagram, Facebook, LinkedIn, Bluesky and Pinterest, as a link with a caption or as a branded image made from your own template. It connects your site to your PlanBatch account (https://planbatch.com), which renders the images, schedules the posts and publishes them through each network's official API.

What the plugin does:

* **Auto-share new posts.** When a post, page, product or any post type you pick is published, PlanBatch schedules a social post for it on the networks you chose.
* **Drip-schedule what you already have.** Bulk Share, under the PlanBatch menu, takes posts and WooCommerce products you published long ago and spreads them over the days and times you choose, one per slot, so a back catalogue becomes weeks of posts in one go. Products can go out as a carousel of their gallery images.
* **Re-share older posts automatically.** Turn on recycling and PlanBatch re-shares content it has already published for you to Facebook, Instagram and LinkedIn on a schedule you set, within your plan's monthly allowance. Mark any post "Never recycle" from the posts list to keep it out.
* **Branded images from your templates.** Pick a PlanBatch template and each post fills it with its own title, text and featured image. A template's text fields can take the post's own text or a value you type, an emoji field is a dropdown of the emoji PlanBatch can draw, and an icon field searches the icons PlanBatch can draw, with a preview.
* **Every post in a bulk share can differ.** Bulk Share sets the starting point for the whole batch, then any selected post can have its own template, field values, caption, first comment and networks. A post starts from its own PlanBatch panel when it has one.
* **Your own AI assistant, kept to the post.** If you want help with the wording, Bulk Share builds a prompt carrying each selected post's text for the assistant you already use. It is told to summarise only what the post says, add nothing of its own, and quote the sentence behind every slide, which Bulk Share shows you before anything is scheduled. PlanBatch sends nothing to any AI, and your posts are not changed.
* **Captions you control.** A caption pattern with {title}, {url}, {excerpt}, {hashtags} and {price} placeholders, an optional first comment for the link, and tracking parameters added to the link.
* **Per-post overrides.** A PlanBatch panel on the post editor gives one post its own template, text, caption, networks and time, or turns sharing off for it.
* **Status on the posts list.** A PlanBatch column shows whether each post is scheduled, skipped or not sent yet, and why.

Networks: Instagram, Facebook, Bluesky, LinkedIn profiles and Pinterest are live. A Pin needs a branded image and a board. LinkedIn Pages and Threads are built in PlanBatch and in review with those platforms; they are not available to customers until each platform approves them, and Threads appears in the plugin only for accounts PlanBatch has given early access.

Behind the plugin, PlanBatch is a bulk social media tool: it turns a spreadsheet, a form, your images and videos, or your WordPress posts into branded posts and publishes them from one calendar. Every post the plugin schedules appears in that calendar, where you can edit, move or delete it before it goes out. The plugin itself is a thin client and renders nothing on your server.

A PlanBatch account is required. The free plan needs no payment details and includes 20 scheduled posts and 30 generated images a month, 2 connected channels and 1 brand. Paid plans start at $19 a month (prices exclude VAT).

== External services ==

This plugin is a client for PlanBatch (https://planbatch.com), a social media scheduling service operated by the plugin author. The plugin makes no external requests until you explicitly connect the site from PlanBatch, Settings.

What is sent, and when:

* On every request once connected: the plugin's version number, in a header. It is recorded against this site's API key so that support knows which version a site runs. It is not used for anything else and it identifies the site's key, not a person.
* When you click Connect: your site URL and site name, to create the connection request.
* When a post you configured for auto-share is published: an identifier built from your site URL and the post ID, the post title, its excerpt, its permalink, its featured image URL, its tag names (used for the {hashtags} placeholder), and for a WooCommerce product its formatted price. Alongside these go the settings you chose: caption pattern, first comment pattern, link tracking parameters, platform and placement choices, the template, any template field values, and a scheduled time if you set one.
* When you use Bulk Share: the same for each item you selected, in one request. If you enable gallery images, this includes the WooCommerce product gallery image URLs for the selected products.
* When you open the plugin settings page or the bulk share page while connected: authenticated requests for your PlanBatch plan, connected channels, templates, a template's field list, and Pinterest boards, to populate the forms.
* When you search an icon field: the text you typed, to list matching icon names. Your browser then loads small pictures of icons from planbatch.com.
* When a template preview is drawn while you edit: the template and the field values on screen, to draw the picture. Nothing is stored.
* When you use Prepare for AI in Bulk Share: for each selected post, its title, link, summary, subheadings with their first sentence, categories, tags, whether it has a featured image, and the post's own text (up to 6,000 characters, as plain text), so PlanBatch can write the prompt. The text is there because the prompt tells the assistant to write only from it. Nothing is stored and nothing is sent to any AI service; you copy the prompt into the assistant you choose.
* When you import an assistant's answer: the text you pasted, to check it against your templates. Each slide's quoted sentence is checked against the post here, on your site. Nothing is stored or scheduled until you press Schedule.
* When an imported answer names a photo for a post: your browser loads that photo from Unsplash (images.unsplash.com) to show it on the post and to check that it exists. If you schedule the post, the photo's link is sent to PlanBatch in place of the featured image URL. Unsplash is a third-party service: license https://unsplash.com/license, terms https://unsplash.com/terms, privacy policy https://unsplash.com/privacy.
* When you open or save the Prompt brief in PlanBatch, Settings: the five brief lines (business, language, tone, audience, offer), read from and saved to your PlanBatch brand. The suggestions shown when a line is empty come from this site's title, tagline, language and address, and are sent only if you save them.
* When Bulk Share shows a template preview: a request for that template's preview, and your browser then loads the picture from PlanBatch's image storage through a link that expires within the hour.

PlanBatch downloads the images a shared post references and stores its own copy, so that a post scheduled for later still publishes with its image if the original is moved or deleted.

Nothing is sent before you connect. No browsing data, no visitor or analytics data, no content of unpublished posts, no post content beyond the fields listed above, and nothing from post types you did not select.

What is sent, in plain language: https://planbatch.com/wordpress/data
Terms of service: https://planbatch.com/terms
Privacy policy: https://planbatch.com/privacy

== Installation ==

1. Create a PlanBatch account at https://planbatch.com/signup?utm_source=wordpress.org&utm_medium=plugin-listing if you do not have one. The free plan needs no payment details and is enough to use this plugin.
2. Install and activate the plugin.
3. Open PlanBatch in the admin menu and click Connect to PlanBatch. (Before version 1.0.12 the page was under Settings, PlanBatch; that address still works.)
4. Approve the connection in the PlanBatch tab that opens, and pick which of your brands this site belongs to.
5. On the Auto-share tab, choose platforms, post types, image mode and caption pattern, then save.
6. Publish a post. The PlanBatch column on the posts list shows the share status.

== Frequently Asked Questions ==

= Do I need a PlanBatch account? =

Yes. The plugin is a client for PlanBatch and does no scheduling, rendering or publishing on its own, so nothing works without connecting an account. You can register at https://planbatch.com/signup?utm_source=wordpress.org&utm_medium=plugin-listing. The free plan requires no payment details and includes 20 scheduled posts and 30 generated images a month and 2 connected channels; higher volumes need a paid plan, from $19 a month excluding VAT.

= Which social networks can it post to? =

Instagram, Facebook, Bluesky, LinkedIn profiles and Pinterest. A Pin needs a branded image and a board, so Pinterest auto-shares only when both are set; a post without them is left out of Pinterest and the PlanBatch column says so. LinkedIn Pages and Threads are in review with those platforms and become available when each one approves PlanBatch. A Facebook Page and the Instagram account linked to it count as two connected channels.

= Can it share posts I published before installing it? =

Yes. Bulk Share, under the PlanBatch menu, lists your published posts, pages and products. Select the ones you want, pick the days of the week and times of day, and PlanBatch schedules one item per slot until all of them are placed. Anything already shared through PlanBatch is skipped unless you tick "Share these again".

= Does it work with WooCommerce? =

Yes. Products can auto-share when published and can be bulk shared like posts. The {price} placeholder adds the price as the shop shows it, sale price included, and Bulk Share can post a product's gallery images as a carousel of up to 10.

= Does editing an already-published post share it again? =

No. Auto-share fires only when a post first becomes published. PlanBatch also deduplicates on its side, so a hook firing twice cannot create two social posts. To share older posts again on purpose, use recycling on the settings page or "Share these again" in Bulk Share.

= Does it generate images on my server? =

No. Images are rendered by PlanBatch from your templates. Your site sends the post's title, excerpt, link and image address, and nothing heavy runs in WordPress.

= Where do I see or edit the scheduled social posts? =

In your PlanBatch calendar at https://planbatch.com. The plugin shows whether scheduling succeeded; the calendar is where you change a post before it publishes.

= How do I disconnect? =

Click Disconnect on the settings page, then revoke this site's API key in your PlanBatch settings.

== Screenshots ==

1. PlanBatch, Settings: the Connection tab, showing the account, whether auto-share and recycling are on, and a way to Bulk Share.
2. The PlanBatch panel on the post editor: give one post its own template, template text, networks, summary, caption and time without changing the site-wide settings.
3. Bulk Share: four steps to drip-schedule posts and products you have already published, with a summary of what will be scheduled before you press the button.
4. The posts list: a PlanBatch column showing whether each post is scheduled, skipped or not sent yet, with the reason on hover.
5. Template fields on Bulk Share: leave "use the post's own text" ticked and every post fills that field with its own, or untick it and type one value for the whole batch.
6. The result in PlanBatch: the posts this site scheduled, spread over the days and times chosen in Bulk Share, ready to edit or move before they publish.

== Upgrade Notice ==

= 1.0.12 =
Settings and Bulk Share move to their own PlanBatch menu (old links still work). Settings has tabs, Bulk Share has four steps with a summary before you schedule, and Prepare for AI now carries each post's text and asks the assistant to quote what each slide is based on.

= 1.0.11 =
Shared links use the address visitors see, including a language prefix such as /en/, and any emoji can be used in images.

= 1.0.10 =
The Prompt brief takes several calls to action, one per line, and the AI picks the one that fits each post.

= 1.0.9 =
Icon search finds icons by meaning and by part of a name, and says when nothing matches.

= 1.0.8 =
Prepare for AI can now pick a different template for each post and suggest Unsplash photos, and your business, language and tone are typed once under Settings.

= 1.0.7 =
Help text only: it now says where each network makes a link clickable. No change to how the plugin works.

= 1.0.6 =
Templates are chosen from thumbnails with a live preview, carousels are built from a post's own subheadings, and Bulk Share can prepare a prompt for an AI assistant and import its answer. Every post in a batch can differ. Pinterest can be auto-shared.

= 1.0.5 =
Listing and readme refresh only. No change to how the plugin works.

= 1.0.4 =
A template's emoji field is now a list of the emoji PlanBatch can draw, instead of a text box.

= 1.0.3 =
The link to connect accounts opens PlanBatch's Connections page.

= 1.0.2 =
Bluesky can be chosen wherever the other networks can, once a Bluesky account is connected in PlanBatch. Pinterest is now chosen per post, with its own board picker.

= 1.0.1 =
Auto-share no longer sends to Pinterest from the site-wide defaults. Tick Pinterest in a post's PlanBatch panel to publish that post as a Pin.

= 1.0.0 =
First public release. If you were running a pre-release copy, reconnect the site only if the settings page reports it is not connected.

== Changelog ==

= 1.0.12 =
* New: a PlanBatch menu holds Settings and Bulk Share, instead of one under Settings and one under Tools. The old addresses redirect.
* New: Settings is split into tabs (Connection, Auto-share, Prompt brief, Recycling), each with its own Save, so saving one can no longer drop unsaved changes in another. Leaving a tab with unsaved changes asks first.
* New: the Connection tab says whether auto-share and recycling are on, and Disconnect asks for a second click before it disconnects.
* Changed: Auto-share lists Platforms first and says when auto-share is off; link tracking, per-network text, long titles and scheduled-post timing move into an Advanced section.
* Changed: Recycling times are picked with time inputs, one per row, like Bulk Share.
* Changed: per-network captions and first comments sit with the caption and first comment they replace, and list only the networks that are ticked; link tracking moves into Advanced on both pages.
* New: Bulk Share asks first how each post's words are written, then runs in four steps (choose content, starting point for every post, each post, schedule) and states what will be scheduled, to which networks, and until when, next to the button. The button waits until a platform, a day and a time are chosen.
* New: Prepare for AI sends each selected post's own text and the prompt tells the assistant to write only from it and to quote the sentence each slide is based on. Bulk Share shows those quotes on each post and flags one it cannot find in the post.
* New: Facebook and Instagram can take a feed post, a Story, or both, in Bulk Share, on the Auto-share tab and in each post's PlanBatch panel. Both makes two posts on that network and counts both.
* New: each post's editor shows a carousel as a strip of slide pictures; click one to edit just that slide, add, move and remove steps on the strip, and see the picture beside the fields. The same strip is in the post panel.
* New: text an AI import wrote per network sits in one tab per network, caption and first comment together.
* Fixed: a photo template's preview showed the template's sample photo instead of the post's featured image or the assistant's photo, which looked like a stock photo had been chosen. The scheduled image was always the right one.
* Fixed: choosing Carousel in a post's PlanBatch panel snapped back to One image for a post without saved slides or three subheadings.
* Changed: Bulk Share's summary says how many selected posts are already shared and will be skipped, holds the button when the AI answer was chosen but nothing is imported, and the page asks before you leave with unsaved choices. Opening a post no longer marks it as changed.
* Changed: the Auto-share status follows the form as you edit it and warns when Instagram or Pinterest is ticked with a shared link; Recycling's settings dim while recycling is off; the AI template list is folded into a count.
* Changed: the icon field shows the chosen icon, a search and a Browse icons button; the grid opens only when asked for.
* Changed: Bulk Share no longer lists plugin-internal post types or WooCommerce's cart, checkout and account pages, and shows "Needs shortening" instead of "blocked".

= 1.0.11 =
* Fixed: on a site whose translation plugin adds a language prefix (such as /en/) only for visitors, every shared link went through a redirect. PlanBatch now asks the site once where a post lives and shares that address. An AI answer that uses the old address still imports.
* Changed: any emoji can be used in an emoji field, not only the ones in the list. The field suggests common emoji and takes any other you type or paste, and images draw every emoji, inside text too.

= 1.0.10 =
* Changed: the Prompt brief's "Offer or call to action" is now "Calls to action", with room for one per line (a service and its page). Prepare for AI keeps each post's own link as its main link and adds at most one matching call to action, only in Facebook and LinkedIn first comments and as a pointer to your Instagram bio.
* Changed: when the brief is empty, the suggested call to action is your contact page, if the site has one, instead of the home page.

= 1.0.9 =
* Changed: icon search matches part of a name and what an icon means, so "bank" finds the piggy bank and "money" finds wallets and coins, closest matches first.
* Fixed: an icon search with no match, or one that did not answer, now says so instead of showing the common icons as if they were results. The "not an icon name" warning now waits until you leave the field.

= 1.0.8 =
* New: Prepare for AI describes every template, so the assistant can choose one that fits each post instead of using the same design for all of them.
* New: an imported answer can name an Unsplash photo for a post. It is shown on the post, checked before it is used, and the post keeps its featured image when the photo cannot be loaded or you choose to.
* New: a batch option credits the photographer in the first comment when a post uses such a photo.
* New: a Prompt brief under Settings, PlanBatch: your business, language, tone, audience and call to action, saved with your PlanBatch brand and filled into every prompt. Empty lines start from this site's title, tagline, language and address.
* Changed: an icon field opens on a wider set of common icons, says that typing searches every icon, and Prepare for AI names the same icons to the assistant.

= 1.0.7 =
* Changed: the first comment help text no longer says a link in an Instagram comment can be tapped. Instagram makes links clickable only in your profile bio; on LinkedIn and Facebook a link in the comment is clickable.

= 1.0.6 =
* New: templates are chosen from thumbnails drawn in your brand, with the one that suits the post suggested first, and a live preview redraws as you type.
* New: carousel templates post as a carousel from WordPress: a cover, steps started from the post's own subheadings, and a closing slide, all editable.
* New: fields start from what the post already says: its title and summary as placeholders, and a number from the title, its category and a fitting icon as values you can change. Nothing is filled with invented text.
* New: Bulk Share can prepare a prompt for ChatGPT, Claude or another assistant, and import its answer to fill each post for you to check before scheduling.
* New: Bulk Share has an Each post section. Every selected post starts from the batch settings, or from its own PlanBatch panel when it has one, and can be given its own template (with a preview drawn in your brand), field values, caption, first comment and networks.
* New: icon fields search the icons PlanBatch can draw and show the chosen one, in Bulk Share and in the post's PlanBatch panel. PlanBatch now refuses an icon name it cannot draw instead of publishing a blank.
* Changed: Pinterest can be a site default for auto-share, like any other network. A post is left out of Pinterest only when it has no branded image or no board, and the PlanBatch column says so.
* Changed: settings that only apply to some networks (the Pinterest board, Story placements) show only while those networks are ticked, and product galleries only on a site with products.
* Changed: when the Pinterest account has no boards yet, the plugin says so instead of showing an empty list.
* New: Threads appears for accounts PlanBatch has given early access while Threads is in review.
* Changed: the plugin listing and readme name Pinterest as live, alongside Instagram, Facebook, Bluesky and LinkedIn profiles. LinkedIn Pages and Threads stay in review.
* Fixed: in the block editor, the Mode and Pinterest board lists no longer run past the edge of the PlanBatch panel, and updating the plugin can no longer leave the browser running an older copy of its scripts.
* Changed: when WordPress gives no usable excerpt (common on page-builder posts), the post's opening sentence is shared as its summary instead of the title alone. An excerpt you wrote is always used as written.
* Changed: the default template can be chosen from thumbnails in Settings whatever the image mode, since a post can switch to a branded image on its own. With no default set, a post's PlanBatch panel asks for a template instead of offering an empty default.
* Changed: a carousel template is described by what a post can hold (a cover, 1 to 8 steps and a closing slide) rather than by how many slide designs the template has.
* Changed: in Bulk Share, Prepare for AI follows the image mode: when the batch shares links, the prompt asks for captions only and offers no templates. Import says when an answer chose images that a link batch cannot use.
* Changed: the Bulk Share prompt asks for captions on the ticked networks only, with each network's caption and image limits. When they take carousels of different lengths (Pinterest 5, Bluesky 4), you choose between the same slides everywhere or a shorter carousel written for those networks, with the most images a post can cost either way. A post shows which networks got their own slides, and can give them its carousel instead.

= 1.0.5 =
* Changed: the plugin listing and readme describe what the plugin does today, including Bulk Share, recycling and which networks are live or in review. No code change.

= 1.0.4 =
* Changed: a template's emoji field, in a post's PlanBatch panel and in Bulk Share, is a list of the emoji PlanBatch can draw on the image. Any other emoji used to come out as a box; PlanBatch now refuses it.

= 1.0.3 =
* Changed: the link to connect accounts now opens the Connections page in PlanBatch, where connected accounts now live, instead of Settings.

= 1.0.2 =
* New: Bluesky. A Bluesky account connected in PlanBatch can be chosen in the settings, in a post's PlanBatch panel and in Bulk Share, with its own first comment. Evergreen recycling does not post to Bluesky.
* Changed: Pinterest is no longer offered among the site-wide auto-share networks, because it could never auto-share: Pinterest wants every Pin chosen by hand. Tick it on the post itself, in its PlanBatch box, as before.
* New: a Pinterest board picker in each post's PlanBatch box, shown once Pinterest is ticked. The settings page keeps a default board, which the picker starts from.
* Changed: the PlanBatch box greys out networks that are not connected in PlanBatch, as the settings page already did.
* Fixed: uninstalling the plugin also removes its cached templates and boards.

= 1.0.1 =
* Changed: auto-share no longer sends to Pinterest from the site-wide defaults. A post is published as a Pin only when Pinterest is ticked in its own PlanBatch panel, because Pinterest requires each Pin to be chosen. If the defaults include Pinterest and a post has no such choice, the other platforms are shared as before and the PlanBatch column says Pinterest was left out. Bulk Share, where you pick each post, is unchanged.
* Changed: the PlanBatch panel no longer ticks Pinterest for you from the site defaults.
* Changed: the sign-up links on the settings page and in this readme say they came from the plugin, so PlanBatch can tell how people find it. Nothing is sent from your site.

= 1.0.0 =
* First public release.
* The plugin now tells PlanBatch which version it is, so a site running an old copy can be recognised rather than guessed at.

= 0.2.0 =
* New: a PlanBatch panel on the post editor, so a post can have its own template, placeholder text, caption, platforms and time instead of the site-wide settings.
* New: fill a branded template's own text fields per post, so templates that need a headline and a subline can be used from WordPress at all.
* New: turn sharing off for a single post, without changing the settings for every other post.
* New: choose whether a post scheduled in WordPress reaches the calendar when it publishes (recommended) or as soon as it is scheduled.
* New: a share is taken back off the calendar automatically if the post is trashed before it publishes, or corrected if its address changes.
* Fixed: WooCommerce prices were shared with the currency symbol as raw HTML, so a caption read "&#36;249.00" instead of "$249.00". Affected every currency.
* Fixed: a product on sale shared a caption repeating itself ("Original price was... Current price is..."). It now reads as the shop shows it, "$249.00 $199.00".
* Fixed: a post built with Divi, WPBakery or Fusion and no hand-written excerpt shared its layout markup ("[et_pb_section][et_pb_row]...") as the caption. The words inside are shared instead.
* Fixed: on Divi 5 the same post shared an empty caption instead, because the newer builder registers its shortcodes and WordPress then removed the text along with them.
* Fixed: a page built in Elementor shared no caption text at all, since Elementor keeps its content outside the post body. Its text is now read.
* Fixed: an [elementor-template] embed appeared in the caption as raw shortcode.
* Fixed: the PlanBatch box could sit below the visible area of the editor, so it looked like the plugin had no per-post settings at all. It now appears under the editor in the classic screen and in the sidebar in the block editor.
* New: the PlanBatch box shows the summary it will share and lets you replace it for one post, so you can see the wording before it goes out instead of after.
* New: a post with content that PlanBatch cannot read a summary from now says so on the posts list, instead of quietly sharing the title alone.
* New: if the summary PlanBatch reads still looks like page-builder code rather than a sentence, it is left out and reported instead of being posted to your accounts.

= 0.1.1 =
* Bulk Share: large selections are submitted in batches so the whole selection is scheduled, with visible progress.
* Bulk Share: warns before scheduling when link mode would exclude a channel that requires an image, instead of reporting it afterwards.
* Bulk Share: Add time now starts each new row half an hour after the last one.
* Fixed: a batch split into several requests could place two items on the same time slot.
* Fixed: a connected Instagram account could be reported as not connected.

= 0.1.0 =
* Initial release: connect flow, auto-share on publish with link or branded-image mode, caption pattern, per-platform selection, status column.
