wp_link_pages_link

Filters the HTML output of individual page number links.

Description

apply_filters( 'wp_link_pages_link', (string) $link, (int) $i ); 

Parameters (2)

0. $link (string)
The page number HTML output.
1. $i (int)
Page number for paginated posts' page links.

Usage

To run the hook, copy the example below.
  1. $link = apply_filters( 'wp_link_pages_link', $link, $i ); 
  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 wp_link_pages_link callback 
  2. function filter_wp_link_pages_link( $link, $i ) { 
  3. // make filter magic happen here... 
  4. return $link
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'wp_link_pages_link', 'filter_wp_link_pages_link', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'wp_link_pages_link', 'filter_wp_link_pages_link', 10, 2 ); 

Defined (3)

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

/wp-includes/post-template.php  
  1. $link = apply_filters( 'wp_link_pages_link', $link, $i ); 
  1. $output .= apply_filters( 'wp_link_pages_link', $link, $prev ); 
  1. $output .= apply_filters( 'wp_link_pages_link', $link, $next );