WordPress.org

Ready to get started?Download WordPress

Forums

WP-EMail
[resolved] Block search engines to index send by email page (6 posts)

  1. Milos Spasic
    Member
    Posted 3 months ago #

    How can I add:

    <meta name="robots" content="noindex,nofollow" />

    to head section of send by email page?

    And why this isn't default plugin feature?

    https://wordpress.org/plugins/wp-email/

  2. Lester Chan
    Member
    Plugin Author

    Posted 3 months ago #

    You can't because the plugin doesn't use it's own template but rather takes the template for your theme page.php. Let me see if there is anyway around it.

    The email link generated has already rel nofollow added to it. And if you are using popup, the nofollow code is in the meta tag as well

  3. Milos Spasic
    Member
    Posted 3 months ago #

    I don't use popup, so please help me to find some solution.

    I really appreciate any help you can provide.

  4. Milos Spasic
    Member
    Posted 2 months ago #

    I have found the solution for the problem.

    Just add this to your theme functions.php file:

    //Ad meta tag noindex,nofollow to the head section of WP-Email send page
    function WP_Email_noindex() {
        $uri = $_SERVER['REQUEST_URI'];
        $elements = explode('/', $uri) ;
        $segment2 = $elements[2] ; //For the 2nd segment of the URL
        if ($segment2 == 'email') {
            echo "\n" . '<meta name="robots" content="noindex,nofollow" />';
        }
    }
    add_action('wp_head', 'WP_Email_noindex');

    My Permalink Settings are domain.com/postname so this works for me.

    If your Permalink Settings are different, check out this post: "Get url segment in wordpress" → webinbangla.com/get-url-segment-wordpress

  5. Lester Chan
    Member
    Plugin Author

    Posted 2 months ago #

    Actually I implemented it. Try the dev version https://github.com/lesterchan/wp-email/archive/master.zip

  6. Milos Spasic
    Member
    Posted 2 months ago #

    I have tried it, works perfectly.

    Thank you, problem permanently solved.

Reply

You must log in to post.

About this Plugin

About this Topic