How to Bulk Noindex Pages Without a Plugin in Wordpress

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; ?>