Dynamic Connector Block

One block that shows different content on each post, based on rules you set.

Lauren Gray Avatar

Dynamic Connector Block lets you put one block in your posts and have it show different content depending on the post. You write each version once as a piece of Conditional Content, give it rules (like “posts in Desserts”), and the block shows the best match on each post. Change the content once and every post that uses it updates.

Before you start

  • WordPress 5.8.3 or later
  • PHP 7.0 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 find a new Dynamic Connector Block menu in your dashboard. That’s where your Conditional Content lives.

How to use

There are two parts: the Conditional Content items you create in the dashboard, and the Dynamic Connector Block you place in your posts. The block looks at the post it’s in and shows the one Conditional Content item that fits best.

Create Conditional Content

  1. Go to Dynamic Connector Block → Add New.
  2. Give it a title. The title is just for you; it isn’t shown on your posts.
  3. Build the content with any blocks you like: an email opt-in form, an affiliate product, a book promo, anything.
  4. In the sidebar’s Rulesets panel, click Use Rulesets to add your first condition (see below).
  5. In the sidebar’s Settings panel, set a Priority number.
  6. Publish.

Set rules for where it shows

Each condition is a row with three parts: what to check, how to compare, and the value.

  1. In Rulesets, click Use Rulesets. A Condition 1 row appears.
  2. Pick the field. In the free version, that’s Category.
  3. Pick the operator (Contains) and choose the category.
  4. To add another condition, click the + button (Add new condition). To remove one, click the minus button (Delete Condition) on its row.

In the free version, content shows on a post when any of its conditions match. So “Category Contains Breakfast” plus “Category Contains Brunch” shows on posts in either one.

Use Priority to pick the winner

A post can match more than one item. When it does, the item with the highest Priority number wins. Every new item starts at 0.

Example: you have a “Breakfast ebook” item for the Breakfast category at Priority 0, and a new “Muffin ebook” item for the Muffins category at Priority 10. A post in both Breakfast and Muffins shows the Muffin ebook. Every other Breakfast post keeps showing the Breakfast ebook. No posts to edit.

Make a default for everything else

A Conditional Content item with no rules matches every post. Use that as your catch-all: create an item, leave Rulesets empty, and give it a lower Priority than your targeted items. Posts that don’t match anything more specific get the default.

If nothing matches at all, the block shows nothing on that post. That can be handy for seasonal content you only want up part of the year.

Add the block to a post

  1. Open a post in the block editor.
  2. Click + (or type /) and add the Dynamic Connector Block.
  3. The editor shows a preview of whichever item matches the post’s current categories. Change the post’s categories and the preview follows.

If you see No Content Found, nothing matches that post yet. Create a matching item or a default (see above).

Want it in every post without inserting it by hand? Put the block in your single post template in the Site Editor, or pair it with Automatic Block Inserter. When the block sits inside an Automatic Block, the editor shows a placeholder that says “This block will display your dynamic content on the frontend.” instead of a preview.

Manage your items

  • Dynamic Connector Block → Conditional Content lists all items with a Priority column. The list is sorted by Priority, highest first, and you can click the column to re-sort.
  • Use Quick Edit on any item to change its Priority without opening it.

Settings

Plugin settings

Go to Dynamic Connector Block → Settings.

  • Alternative Insertion (Enable checkbox): “If other plugin content is being inserted along with your blocks, try enabling this setting.” Normally your content runs through WordPress’s standard content filter, which other plugins hook into. This switches to a leaner render that still handles blocks, shortcodes and paragraphs but skips other plugins’ additions. Default: off.

Conditional Content sidebar

  • Priority (in Settings): higher numbers win when several items match a post. Default: 0.
  • Rulesets: the conditions that decide which posts this item can show on. Default: none, which means it can show on any post.

What Pro adds

  • Any public taxonomy. Rules can check tags and custom taxonomies, not just categories.
  • Not Contains. Taxonomy rules get a Not Contains operator, so you can exclude posts in a term.
  • Title rules. Match on the post title with Contains, Not Contains, Is or Is Not. Contains looks for a whole word in the title (not case-sensitive), so “muffin” matches “Blueberry Muffin Recipe” but not “Muffins”. Is compares the full title.
  • Match All Conditions. A toggle at the top of Rulesets. When on, every condition has to match, not just one. Default: off.
  • Groups. A Groups screen under the Dynamic Connector Block menu, and a Group setting on the block (“Narrow down search to specific group”). Put items in groups like “Email opt-ins” and “Featured products,” then set each block to a group. That way you can use several Dynamic Connector Blocks in one post and each one pulls from its own set. A block with no group picks from all items.

Developer reference

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

dynamic_connector_block_query_args

Filter. Changes the WP_Query arguments used to find connector content for a block. Receives the query arguments, the block attributes and the current post ID.

add_filter( 'dynamic_connector_block_query_args', function ( $query, $attributes, $post_id ) {
	$query['post_status'] = array( 'publish', 'private' );
	return $query;
}, 10, 3 );

dynamic_connector_block_conditional_posts

Filter. Changes the matching connector posts after the query runs. Receives an array of WP_Post objects, the block attributes and the current post ID. The first post is shown. Return an empty array to show the block’s default content.

spdcb_get_dynamic_post_content( $post, $attributes = array(), $cache = true )

Function. Returns the content a Dynamic Connector block would show for a post (an ID or WP_Post), or for an array of term IDs. Matches are cached for six hours; pass false as the third argument to skip the cache.

FAQs

Isn’t this the same as a synced pattern (reusable block)?

Not quite. A synced pattern shows the same thing everywhere. This block picks different content per post based on your rules.

Will it match my site’s styles?

Yes. The block doesn’t load any front-end styles of its own, so your content renders the way those blocks normally do on your site.

Does it need other plugins?

No. You can use blocks from other plugins inside your Conditional Content, but nothing else is required.

Does it cache anything?

Yes. Once a post’s match is worked out, it’s remembered for up to 6 hours. That cache is cleared automatically whenever any post or Conditional Content item is saved or deleted, so edits show up right away.

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.