Support » Fixing WordPress » wp_link_pages code produces ampersand invalid markup

  • Resolved thedrumdoctor


    I have searched for this but can’t find an answer as yet.

    My page.php file uses the follwing code to generate navigation links:

    <?php wp_link_pages('before= &after= &next_or_number=next &previouspagelink=Go back &nextpagelink=Next page'); ?>

    However, the HTML code it generates produces ampersands that the WC3 validator doesn’t like:

    <a href="">Go back </a><a href="">Next page</a>

    I’m using XHTML 1.0 Strict as my doctype and it doesn’t like the page_id=184&page ampersands. Is there a way of tweaking the PHP code so it will produce ampersands in escape characters, so it will parse correctly in the validator?

Viewing 1 replies (of 1 total)
  • To fix this I edited the permalink settings to a custom structure:


    This now validates XHTML 1.0 Strict.

    Thanks must go to support for suggesting this.

Viewing 1 replies (of 1 total)
  • The topic ‘wp_link_pages code produces ampersand invalid markup’ is closed to new replies.