This works for applying the same class name for each next and previous, but looking to apply different class names to each.
function posts_link_attributes() {
return 'class="link-more"';
}
add_filter('next_posts_link_attributes', 'posts_link_attributes');
add_filter('previous_posts_link_attributes', 'posts_link_attributes');
Try it with the current_filter() function
https://developer.ww.wp.xz.cn/reference/functions/current_filter/
function posts_link_attributes( $attributes ) {
// Check with current_filter what filter was used.
if ( 'next_posts_link_attributes' === current_filter() ) {
return 'class="next-class"';
}
return 'class="previous-class"';
}
add_filter( 'next_posts_link_attributes', 'posts_link_attributes' );
add_filter( 'previous_posts_link_attributes', 'posts_link_attributes' );