paginate_links

Filters the paginated links for the given archive pages.

Description

apply_filters( 'paginate_links', (string) $link ); 

Parameters (1)

0. $link (string)
The paginated link URL.

Usage

To run the hook, copy the example below.
  1. $link = apply_filters( 'paginate_links', $link ); 
  2.  
  3. if ( !empty( $link ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the paginate_links callback 
  2. function filter_paginate_links( $link ) { 
  3. // make filter magic happen here... 
  4. return $link
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'paginate_links', 'filter_paginate_links', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'paginate_links', 'filter_paginate_links', 10, 1 ); 

Defined (3)

The filter is defined in the following location(s).

/wp-includes/general-template.php  
  1. $page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['prev_text'] . '</a>'; 
  1. $page_links[] = "<a class='page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</a>"; 
  1. $page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['next_text'] . '</a>';