{ "@context": "https://schema.org/", "@type": "HowTo", "name": "How to Bulk Noindex Pages Without a Plugin in Wordpress", "image": "http://www.johnmcalpin.com/wp-content/uploads/2021/11/how-to-noindex-pages-in-bulk-with-no-plugin-in-wordpress-e1635815618571.jpg", "totalTime": "PT3M", "estimatedCost": { "@type": "MonetaryAmount", "currency": "USD", "value": "0" }, "supply": { "@type": "HowToSupply", "name": "List of pages to exclude" }, "tool": [{ "@type": "HowToTool", "name": "Code editor" },{ "@type": "HowToTool", "name": "Access to header.php file" }], "step": [{ "@type": "HowToStep", "text": "The fastest way to deploy this script is to organize your pages in a spreadsheet. According to the WordPress Codex, you can use page names or post IDs as conditional tags in this script. Place either the page names or post IDs in column A of your spreadsheet. Check out the screenshot, you can see that all you need here is the post title, which is often used as the H1 for pages. Make a copy of this Google Sheet template to expedite the steps after this.", "image": "http://www.johnmcalpin.com/wp-content/uploads/2021/11/spreadsheet-of-example-pages.jpg", "name": "Collect Pages in Spreadsheet", "url": "http://www.johnmcalpin.com/blog/noindex-pages-in-bulk-without-plugin/#collect-pages-in-spreadsheet" },{ "@type": "HowToStep", "text": "Using the spreadsheet above, a few things will automatically happen: The second tab of the spreadsheet will concatenate your page titles in the proper format. If you have more than the sample data, you will need to drag down the formula in columns B-D to complete the spreadsheet. In the third tab “Copy Row 1,” your output of the second tab will transpose into a single row. Copy this into a text editor. If you have white space, you may need to remove that. Below is an example of what your output should look like: ‘page 1’, ‘sample page’, ‘page about something’, ‘another page’, ‘whats with all the pages’, ‘oh great another page’, ‘elephants’, ‘How to Noindex Pages in Bulk Without a Plugin’,", "image": "http://www.johnmcalpin.com/wp-content/uploads/2021/11/concat-page-e1635817252657.jpg", "name": "Format the Pages to Copy to WordPress", "url": "http://www.johnmcalpin.com/blog/noindex-pages-in-bulk-without-plugin/#format-pages-copy-wordpress" },{ "@type": "HowToStep", "text": "Using the script below, we’ll be adding out output into the code and placing it in the header.php of our WordPress site. On the first line, we will be inserting our output into the innermost parenthesis. Example below: ", "image": "http://www.johnmcalpin.com/wp-content/uploads/2021/11/header-php-script-e1635819077971.jpg", "name": "Insert The Script", "url": "http://www.johnmcalpin.com/blog/noindex-pages-in-bulk-without-plugin/#insert-the-script" }] }

How to Bulk Noindex Pages Without a Plugin in WordPress

Published:  November 2, 2021

Looking to add a noindex robots tag to multiple pages in bulk without a plugin? Look no further! This page contains a quick script to add to your website to add a noindex tag to multiple pages in bulk.

Step 1) Collect Pages in Spreadsheet

The fastest way to deploy this script is to organize your pages in a spreadsheet. According to the WordPress Codex, you can use page names or post IDs as conditional tags in this script.

Place either the page names or post IDs in column A of your spreadsheet. Check out the screenshot, you can see that all you need here is the post title, which is often used as the H1 for pages.

Make a copy of this Google Sheet template to expedite the steps after this.

Step 2) Format the Pages to Copy to WordPress

Using the spreadsheet above, a few things will automatically happen:

  1. The second tab of the spreadsheet will concatenate your page titles in the proper format. If you have more than the sample data, you will need to drag down the formula in columns B-D to complete the spreadsheet.
  2. In the third tab “Copy Row 1,” your output of the second tab will transpose into a single row. Copy this into a text editor. If you have white space, you may need to remove that.

Below is an example of what your output should look like:

‘page 1’, ‘sample page’, ‘page about something’, ‘another page’, ‘whats with all the pages’, ‘oh great another page’, ‘elephants’, ‘How to Noindex Pages in Bulk Without a Plugin’,

Insert The Script

Using the script below, we’ll be adding out output into the code and placing it in the header.php of our WordPress site.

<?php if (is_single( array( ‘Beef Stew’, ‘Pea Soup’, ‘Chili’ ) ) ): ?>

<meta name=”robots” content=”noindex”>

<?php endif; ?>

On the first line, we will be inserting our output into the innermost parenthesis. Example below:

<?php if (is_single( array( ‘page 1’, ‘sample page’, ‘page about something’, ‘another page’, ‘whats with all the pages’, ‘oh great another page’, ‘elephants’, ‘How to Noindex Pages in Bulk Without a Plugin’, ) ) ): ?>

<meta name=”robots” content=”noindex”>

<?php endif; ?>

« Back to All WordPress Tricks