Astra Post Navigation — Customising Next/Previous Link Text

I wanted to customise the Astra post navigation labels (next/previous) on single blog posts. Easy enough with a documented code snippet... or was it?

Affiliate Disclosure
This post may contain affiliate links (†). If you purchase a product through these links, BlueMoonCreative.Services may earn a small commission at no extra cost to you.
For further information, please read our Terms & Conditions of Use.

Overview…

I wanted to customise the standard Astra post navigation labels (next/previous) on single blog posts, replacing the default “Previous Post” and “Next Post” text with custom labels. Easy enough with a documented code snippet… or was it?

Goal…

Replace the default Astra single post navigation strings with custom labels — “Next Article →” and “← Previous Article” — while keeping the linked post title displayed beneath each label, matching the existing front-end layout.

First Attempt: Default Strings (Per Astra Documentation)

Astra’s documentation (astra_default_strings filter) suggested the following approach where I just switched out ‘Post’ for ‘Article’:

function bmcs_search_strings_callback( $strings ) {
    $strings['string-single-navigation-next']     = __( 'Next Article %s', 'astra' ) . ' <span class="ast-right-arrow" aria-hidden="true">&rarr;</span>';
    $strings['string-single-navigation-previous'] = '<span class="ast-left-arrow" aria-hidden="true">&larr;</span> ' . __( 'Previous Article %s', 'astra' );
    return $strings;
}
add_filter( 'astra_default_strings', 'bmcs_search_strings_callback', 20 );

This did not work for the navigation strings despite working correctly for other strings in the same function (search placeholder, 404 subtitle, nothing-found messages).

Troubleshooting…

Several approaches were tested without success:

  • Confirmed the filter was firing — other strings within the same callback updated correctly on the front end.
  • Verified the string keys against astra/inc/class-theme-strings.php in the parent theme.
  • Increased filter priority from 10 to 20 to ensure it ran after Astra’s own registration.
  • Removed __() wrappers and %s placeholders to rule out sprintf interference.

None of these resolved the issue. The astra_default_strings filter is unreliable specifically for the post navigation strings — Astra processes these via a dedicated filter (astra_single_post_navigation) rather than pulling from the default strings array at render time.

Second Attempt: Astra Post Navigation (Per Astra Documentation)

Having figured out there was a filter, I found the documentation ‘How to Change Previous and Next Link Text from a Single Blog Post?‘. Copy & Paste… not quite.

The documentation offers up two solutions:

  • Replace default navigation strings with next/previous post titles
  • Replace default navigation strings with custom text

Whilst they both work as intended, unfortunately they just update the actual link text (and omit the label), so in isolation they do not solve my need for maintaining the default format.

The Solution…

Update the astra_single_post_navigation filter to provide full control over both the label text and the post title markup:

add_filter( 'astra_single_post_navigation', 'bmcs_change_next_prev_text' );

function bmcs_change_next_prev_text( $args ) {
    $next_post = get_next_post();
    $prev_post = get_previous_post();

    if ( $next_post ) {
        $args['next_text'] = sprintf(
            'Next Article <span class="ast-right-arrow" aria-hidden="true">&rarr;</span><span class="nav-title"><p>%s</p></span>',
            $next_post->post_title
        );
    }

    if ( $prev_post ) {
        $args['prev_text'] = sprintf(
            '<span class="ast-left-arrow" aria-hidden="true">&larr;</span> Previous Article<span class="nav-title"><p>%s</p></span>',
            $prev_post->post_title
        );
    }

    return $args;
}

Add to your child theme functions.php. Simply update the Next Article / Previous Article text for your own custom text.

The <p> tags wrap the post title inside the %s placeholder within the format string, matching Astra’s native markup output.

Key Takeaways…

  • astra_default_strings works for most Astra UI strings but is not reliable for single post navigation labels — don’t waste time debugging priority or key names.
  • astra_single_post_navigation is the correct hook for next/previous link customisation, regardless of what the astra_default_strings documentation implies.
  • The Astra docs present astra_single_post_navigation as an either/or choice (post title or custom text) — combining both in a single sprintf() format string is straightforward and not documented (that I could find).
  • HTML elements (e.g. <p>) belong inside the sprintf format string alongside the %s token, not concatenated around the PHP variable.
Disclosure: This article was drafted & written by the post author, with AI used as an assistive tool during the process — e.g. to explore ideas, check facts, or suggest phrasing. Final content has been edited, reviewed, & verified by the post author, who holds full editorial responsibility for the content published.
AI Assisted Icon

Look no further than BlueMoonCreative.Services website to see the results of this incredible toolkit in action. Crocoblock integrates seamlessly with our theme & plugins providing all the tools required to, easily & quickly, add dynamic content to our customised pages.
† Affiliate Promotion

Scroll to Top