A block that wraps inner blocks in a link to the current post, for use in query loops.
This plugin provides a single Post Link block that renders its inner blocks wrapped in a semantic <a> tag linking to the current post. It is designed to be used inside a Query Loop block, where it receives the current postId and postType from context.
- Wraps any inner blocks in a post permalink with semantic markup
- Optional "open in new tab" setting (adds
target="_blank"withrel="noopener noreferrer") - Supports color, spacing, and typography controls from the block editor
- Compatible with client-side navigation in block themes
- Clone or download to
/wp-content/plugins/post-link-block/ - Run
npm install && npm run build - Activate the plugin in WordPress
- Download a release bundle or clone the
releasebranch - Upload to
/wp-content/plugins/post-link-block/ - Activate the plugin in WordPress
- Add a Query Loop block to your page
- Inside the Post Template, insert the Post Link block
- Add inner blocks inside Post Link — for example, Featured Image, Title, and Post Date
- On the front-end, the entire inner content is wrapped in a single link to the post
Note: The block only renders a link when a postId is available from context. Outside a Query Loop it will fall back to get_the_ID(), but it is primarily intended for use within query loops.
If you have nvm installed you can run nvm use in the repository root to activate the correct version of Node.
npm install
composer installnpm run buildnpm startnpm run lint- WordPress 6.0+
- PHP 8.2+
- Node.js 24+
Merges to main will automatically build to the release branch. A project may be set up to track the release branch using Composer to pull in the latest built version.
Commits on the release branch may be tagged for installation via Packagist and marked as releases in GitHub for manual download using a manually-dispatched "Tag and Release" GH Actions workflow.
To tag a new release:
- Review unreleased changes and choose the next version number using semantic versioning
- Checkout a
prepare-v#.#.#branch. In that branch:- Bump the version number in
post-link-block.phpandsrc/blocks/post-link/block.json
- Bump the version number in
- Open a pull request titled "Prepare release v#.#.#"
- Review and merge the pull request
- Wait for the
releasebranch to update with the build that includes the new version number - On the "Tag and Release" GH Action page:
- Click the "Run workflow" button
- Fill out the "Version tag" field with your target version number
- This version must match the version in
post-link-block.phpandblock.json - Use the format
v#.#.#for your version tag
- This version must match the version in
- Leave the "Branch to tag" field as
release - Click "Run workflow"
Once the workflow completes, the new version will be tagged and available in the list of releases.
GPL-2.0-or-later
Human Made Limited - https://humanmade.com
