Forums

wp_link_pages() errors (2 posts)

  1. miocene22
    Member
    Posted 1 year ago #

    I'm using the function wp_link_pages() in my wordpress theme to make the page links for multi-paged posts and am coming up against an xhtml validation error. The html generated by the function is not encoding the & in the urls. E.g.
    <a href="http://example.com?p=188&page=2">2</a> should be <a href="http://example.com?p=188&page=2">2</a>

    edit: this forum seems to be unencoding even my coded & symbols. The 2nd example should have a &amp ; instead of a &. (without the space before the ;)

    Here is my code with the function arguments:

    <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', '' ), 'after' => '</div>' ) ); ?>

    Any ideas as to how I can get it to make valid xhmtl?

  2. Mark / t31os
    Moderator
    Posted 1 year ago #

    Closest ticket i could find.
    http://core.trac.wordpress.org/ticket/12126

    See the attached patch, i think that's the source of your issue (with the unencoded &'s).

Topic Closed

This topic has been closed to new replies.

About this Topic