Wordpress Plugins » XHTML Content Negotiation for Wordpress

I wrote this plugin so that I could serve this blog using the application/xhtml+xml content-type (which is what XHTML is supposed to be served as!).

The plugin allows Wordpress to serve content using the application/xhtml+xml MIME type, based on the client’s HTTP ACCEPT request. It also takes into account the q-values of the request, in compliance with RFC2616 HTTP/1.1. The plugin also handles clients that don’t supply an ACCEPT header (e.g., the W3C Validator).

The plugin detects IE6 and above and serves content as text/html, because IE doesn’t follow the HTTP 1.1 requirement and can’t parse application/xhtml+xml anyway.

You can download version 1.3 of the plugin here. If you have any problems or suggestions, please post a note below.

7 Responses to “XHTML Content Negotiation for Wordpress”

  1. Just ran the automatic upgrade to version 1.2 … and now receiving the following error above each of my pages:

    Warning: preg_match() [function.preg-match]: Unknown modifier ‘h’ in /html/plugins/xhtml-content-negotiation-for-wordpress/xhtml-content-negotiation.php on line 29

    Warning: preg_match() [function.preg-match]: Unknown modifier ‘h’ in /html/wp-content/plugins/xhtml-content-negotiation-for-wordpress/xhtml-content-negotiation.php on line 29

    Warning: preg_match() [function.preg-match]: Unknown modifier ‘\’ in /html/wp-content/plugins/xhtml-content-negotiation-for-wordpress/xhtml-content-negotiation.php on line 29

    Got any ideas?

    Btw, Thanks for a great plugin!

  2. P.S. It worked great before I updated this afternoon.

  3. @Matt: Sorry about that – I missed out a bit of code. It should be fixed now – please let me know if you still get an error. Thanks!

  4. Going good again!! :)

    I like this plugin b/c it helps me find errors in my code quickly.

    Thanks again.

  5. Samir,
    when activated Adsense ads not load.
    All the rest seems to work fine.

    ciao Giuseppe

  6. @Giuseppe: That is a problem with Google Adsense which assumes that you will be sending content as text/html, and it breaks if you send it as application/xhtml+xml. This web page offers a Javascript-based solution that seems to work, and doesn’t upset Google.

    Cheers for pointing it out – I’ll add it to the FAQ.

  7. Giuseppe

    Samir,
    thank you

Leave a Reply