Skip to content

Add pagination next url permalink filter#121

Merged
fiwa merged 1 commit intomasterfrom
120-enable-override-of-pagination-next-url-permalink
Sep 20, 2024
Merged

Add pagination next url permalink filter#121
fiwa merged 1 commit intomasterfrom
120-enable-override-of-pagination-next-url-permalink

Conversation

@fiwa
Copy link
Copy Markdown
Collaborator

@fiwa fiwa commented Sep 20, 2024

Closes #120

Example usage:

/**
 * Return the URL of the current term if the page is an archive page.
 */
add_filter('splx_pagination_next_url_permalink', function($permalink) {
    $result = $permalink;

    if (is_archive()) {
        $term = get_queried_object();

        if ($term) {
            $term_permalink = get_term_link($term);

            if ($term_permalink) {
                $result = $term_permalink;
            }
        }
    }

    return $result;
}, 10, 1);

Copy link
Copy Markdown
Collaborator

@perarnborg perarnborg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix!

We should add the new filter to the documentation, but go ahead and merge if urgency is needed!

@fiwa fiwa merged commit e766158 into master Sep 20, 2024
@fiwa fiwa deleted the 120-enable-override-of-pagination-next-url-permalink branch September 20, 2024 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable override of pagination next url permalink

2 participants