Je suis

Gabriel Rodrigue

. Je produis des sites et applications Web ainsi que du contenu texte, audio et vidéo sur les nouvelles technologies et l'entrepreneuriat. (suite)

Fix: paging in Wordpress under IIS

Exceptionnellement, ce billet sera en anglais.

For the last few minutes, I have been trying to figure out why next_posts_link() did not work on a template for a clients’ blog, under IIS.

I found a great tip, but I prefer standard functions over things that work.

Then I found out under IIS, PHP returns a wrong value for $_SERVER["REQUEST_URI"]. The link to the previous page was index.php/Index.php/page/2/. Notice there are two “index.php” (for Windows, index and Index are just the same.)

The real, working, clean and easy solution is to add a simple line of code in the clean_url() function in wp-includes/formatting.php:

$url = str_replace('index.php/Index.php','index.php',$url);

Easy, n’est-ce pas?

Publié le 8 août 2008 à 12:59

Laissez un commentaire