Automatic Block Inserter

Add the same content to every matching post without editing them one by one.

Lauren Gray Avatar

Automatic Block Inserter adds the same content to every post for you. Build it once, choose where it goes (before or after the post content, or next to a certain block), and it shows up on every matching post without you editing a single one.

Before you start

  • WordPress 5.8.3 or later
  • PHP 5.6 or later

Install

  1. In your WordPress dashboard, go to Plugins → Add New Plugin.
  2. Click Upload Plugin.
  3. Choose the plugin zip file.
  4. Click Install Now.
  5. Click Activate.

You’ll see a new Automatic Blocks Inserter menu in your dashboard.

How to use

Create an automatic block

  1. Go to Automatic Blocks Inserter → Add New.
  2. Add a title. It’s only for you to tell your blocks apart; it isn’t shown on your posts.
  3. Build the content you want inserted, using any blocks, just like a regular post. An email opt-in, an ad, an affiliate box, a disclosure: anything goes.
  4. Open the Position panel in the sidebar and choose where it goes (see below).
  5. Publish. Only published automatic blocks are inserted.

Your content is added on single post and page views, inside the post content. It doesn’t appear on archive or home page listings. To change it later, edit the automatic block and every post updates. To stop it, move it to draft or trash it.

Insert before or after the post content

  1. In Position, set Location Type to Post Area.
  2. Set Placement to Before or After.
  3. Leave Select Post Area on Post Content.

Insert next to a specific block

This is how you put content “after the second paragraph” or “before the first image.”

  1. In Position, set Location Type to Block.
  2. Set Placement to Before or After.
  3. Under Block Type, use Search Block Type to find the block to anchor to (for example, Paragraph or Image) and click it. Or turn on Match any block type to count every block.
  4. Set Offset to which one to use: 1 is the first, 2 is the second, and so on. The help text under the field spells out what you’ve picked.

Your content is inserted once per post. If a post has fewer of that block than your offset (say, you picked the 5th paragraph and the post has 3), nothing is added to that post. Blocks inside other blocks, like a paragraph in a Group, are counted too.

Limit it to one post type

By default, Post Type is All Post Types. Pick a post type (like post or page) from the dropdown to only insert there.

Show different content per category

Pair this plugin with Dynamic Connector Block. Put a Dynamic Connector Block inside your automatic block, and each post shows the Conditional Content that matches it. In the automatic block editor, the Dynamic Connector Block shows a placeholder instead of a preview; that’s expected.

Settings

All settings are in the Position panel of each automatic block.

  • Post Type: where this block should be inserted. Default: All Post Types.
  • Location Type: Post Area (the whole post content) or Block (next to a certain block). Default: Post Area.
  • Placement: Before or After the chosen spot. Default: Before.
  • Select Post Area (Post Area only): Post Content. That’s the only option right now.
  • Match any block type (Block only): count every block, whatever its type. Default: off.
  • Block Type (Block only): the block to anchor to, grouped by plugin. Default: the first block in the list.
  • Offset (Block only): which matching block to use, counting from the top. Default: 1.
  • Top Level Blocks (Block only, Pro): only count blocks that aren’t inside another block. Default: off.

What Pro adds

  • Custom post types. The free version covers built-in post types like posts and pages. Pro lets you target any public custom post type.
  • Blocks from other plugins. Free lets you anchor to core WordPress blocks. Pro adds blocks from plugins and themes (for example, a recipe card block).
  • Count from the bottom. Enter a negative Offset to count up from the end of the post: -1 is the last matching block, -2 the second to last.
  • Top Level Blocks. Ignore blocks nested inside Groups, Columns and other containers when counting.

Developer reference

For developers: hooks and functions you can use from your theme or a code snippet.

automatic_block_inserter_supported_post_types

Filter. Changes which post types you can target with an insert rule. Receives an array of post type names. Post types that aren’t public are removed after the filter runs, and the free version only keeps the built-in types.

add_filter( 'automatic_block_inserter_supported_post_types', function ( $post_types ) {
	return array_diff( $post_types, array( 'page' ) );
} );

automatic_block_inserter_after_post_type_register

Action. Fires after the plugin registers its rule post type. Use it to register anything that depends on that post type.

abisp_get_supported_post_types()

Function. Returns the post types the plugin will insert into, after the filter above and the public check.

FAQs

Can I have more than one automatic block?

Yes. Each one has its own Position settings.

Does it change my posts?

No. Your content is added when the page is displayed. Nothing is saved into your posts, so editing or removing an automatic block updates every post at once.

Why do I see a “Complete Opt-In” notice?

Pro shows this until you finish activating your license. Click Complete Opt-In in the notice to start.