Random WordPress Function

Learn about a new WordPress function every day!


Function Signature:

_wp_link_page

Function Description:

Helper function for wp_link_pages().

Function Examples:

⚠️ Examples below are generated with GPT-3 once every hour. Do not take them too seriously.
Consider them as some extra input in your learning process - reason about them. Will it work? What could fail?
// Example 1: Basic usage of _wp_link_page to display paginated links
 '',
        'link_before'      => '',
        'link_after'       => '',
        'next_or_number'   => 'number',
        'separator'        => ' ',
        'nextpagelink'     => __( 'Next page', 'textdomain' ),
        'previouspagelink' => __( 'Previous page', 'textdomain' ),
        'pagelink'         => '%',
        'echo'             => 1
    );
    wp_link_pages( $args );
?>
// Example 2: Using _wp_link_page with custom link text
 '',
        'link_before'      => '',
        'link_after'       => '',
        'next_or_number'   => 'number',
        'separator'        => ' ',
        'nextpagelink'     => __( 'Next page', 'textdomain' ),
        'previouspagelink' => __( 'Previous page', 'textdomain' ),
        'pagelink'         => '%',
        'echo'             => 1,
        'nextpagelink'     => 'Next Section',
        'previouspagelink' => 'Previous Section'
    );
    wp_link_pages( $args );
?>
// Example 3: Handling a common pitfall with _wp_link_page by checking if there are more pages to link
 '',
        'link_before'      => '',
        'link_after'       => '',
        'next_or_number'   => 'number',
        'separator'        => ' ',
        'nextpagelink'     => __( 'Next page', 'textdomain' ),
        'previouspagelink' => __( 'Previous page', 'textdomain' ),
        'pagelink'         => '%',
        'echo'             => 1
    );

    if ( ! empty( $args['nextpagelink'] ) || ! empty( $args['previouspagelink'] ) ) {
        wp_link_pages( $args );
    }
?>