Fill in the form below to make an enquiry or find my contact details on my contact page.

  • This field is for validation purposes and should be left unchanged.

Freelance WordPress Developer

How To Stop Search Engines From Indexing Specific Pages

Add the Robots Meta Tag to Your Theme Header:

The first thing you need to do is add the following code to the head section of your theme’s header.php template.

<?php $noindex = get_post_meta( $post->ID, 'noindex-post', true );
    if ( $noindex ) {
        echo '<meta name="robots" content="noindex,nofollow" />';

You do not need to modify the code above and insert your post ID or post title. Instead of specifying the post or page to block in the code itself, you do it using a custom field. Click add a  custom field give name noindex-post and assign a value noindex-post to it.

Simply repeat the above step for any post type you want to block from search engines.

I believe this is one of the most user-friendly techniques that a developer can configure for a client, as it is so simple to block additional posts and pages. However, it does not give you a quick way of seeing which posts and pages are blocked from search engines, and which are not.



Hi, I'm a Freelance Web Developer and WordPress Expert based in London with a wealth of website development and support experience. I am great at problem solving and developing quick solutions.