Do you find that keeping your "Read Latest", "Start Here", or "Get Started" buttons current to be a hassle?
If so, this simple plugin eliminates those hassles by automatically setting a link/button's URL to your most recent published blog post — no manual edits required!
It's perfect for landing pages, call-to-actions, and onboarding flows where your latest post is always the most relevant next step.
Requirements
- WordPress 6.5+
- PHP 8.0+
What It Does
When the page loads:
- JavaScript fetches the URL of the most recent post via WordPress
admin-ajax.php - It finds the first element with the class
.nurbid-latest-post-url - It replaces the element's
hrefwith the permalink of the latest published post
How It Works
- A server-side PHP function retrieves the latest published post
- A WordPress AJAX endpoint exposes that URL to the front end
- Footer JavaScript updates the
hrefof matching<a>elements
Install
From GitHub Releases
- Download
nurbid-latest-post-url-x.y.z.zipfrom the GitHub Releases page (use the latest release asset) - Go to Plugins > Add New > Upload Plugin
- Upload the zip, then click Install Now and Activate
Setup
1. Add a link or button
In your page builder, template, or HTML:
<a class="nurbid-latest-post-url" href="#">Read Latest Post</a>
- Use any valid anchor (
<a>) - May be inside or outside a
<button>wrapper - Add the class
nurbid-latest-post-url - Use a placeholder
href="#"— it will be replaced automatically
2. Done
The URL updates on each page load. No settings screen.
Shortcode (optional)
Embed the latest post URL in content:
[nurbid_latest_post_url]
Works in:
- Posts and pages
- Page builders that support shortcodes
- PHP templates:
echo do_shortcode('[nurbid_latest_post_url]');
What Else?
Need multiple buttons? Want to extend this for CPTs or categories? Let us know in the comments.

0 Comments