[wp-hackers] Canonical integration into core

Nathan Rice ncrice at gmail.com
Mon Feb 16 21:25:20 GMT 2009


On Mon, Feb 16, 2009 at 4:13 PM, mrmist <listswphackers at mist.org.uk> wrote:
>
>
> <?php if (is_single()) {
>  echo '<link rel="canonical" href="' . get_permalink() . '" />';
> } ?>
>
>
Actually, it would be better to use is_singular there.  It catches posts,
pages, and attachments.  While you're at it, go ahead and do this:

<?php if(is_archive()) {
echo '<meta name="robots" content="noindex">
} ?>

:-)


More information about the wp-hackers mailing list