• Running a modified version of the plugin SEO Super Comments which creates spiderable pages from comments.

    Since link rel=’canonical’ was added to WordPress core (I used to add it at theme level) the single comment pages created by the plugin like

    https://www.google-adsense-templates.co.uk/wordpress-theme-talian-with-adsense-and-seo-optimisation.html/comment-page-4?cid=20040

    Now have a rel=’canonical’ tag within the head pointing to the single blog post the comment is related to. This means Google won’t keep these pages indexed making the plugin useless.

    I use a copy of single.php (renamed and edited) to generate the single comment pages, ideal solution would be to not use the

    add_action( ‘wp_head’, ‘rel_canonical’ );
    from wp-includes/default-filters.php

    For just that template page.

    If that’s not realistic, completely disable the filter at theme level and I’ll just keeping using the code I used to use to add rel=’canonical’ to various pages.

    The theme I use is also sold, so although I could easily remove the filter from wp-includes/default-filters.php I need it at theme level as I’m working on a new release of the theme with support for the SEO Super Comments plugin.

    David

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter David Cameron Law

    (@seo-dave)

    Solved the problem, pretty easy as well.

    Deleted

    <?php wp_head(); ?>

    From the extra single.php template page.

    David

    Won’t that cause problems for other plugins that rely on wp_head?

    Thread Starter David Cameron Law

    (@seo-dave)

    Hi Esmi,

    Since this is a second copy of single.php (I named it single2.php) and all it does is create pages like https://www.45-year-old-millionaire.co.uk/claiming-working-tax-credit-instead-of-job-seekers-allowance-income-support.html/comment-page-1?cid=7006 I don’t need too many plugins to work with those pages.

    Remember this is just about getting the plugin SEO Super Comments to work correctly which generates individual pages from comments.

    On the example page above you’ll note the Tweetme link (from a plugin) isn’t working correctly, doesn’t work on these pages with <?php wp_head(); ?> included either (need to find a fix to block that plugin on those pages). Had a similar problem on another site with a poll plugin that called javascript via the header, had to add it manually so a poll widget would work on these pages.

    You expect a few issues like these when you use plugins like the SEO Super Comments that’s doing something WordPress is not designed for (comments aren’t supposed to have their own pages).

    I did realise later I could use something like:

    remove_action (‘wp_head’, ‘rel_canonical’);

    Added to the functions.php file to block this filter completely and rely on the code I used to use to generate the canonical links. Currently testing with this option ??

    David

    erick_paper

    (@erick_paper)

    Actually remove_action in functions.php does nothing.

    Any other suggestions? I’d like to get rid of the “rel” links created by wp_head.

    Thanks@

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Disable link rel=’canonical’ at theme level’ is closed to new replies.