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.
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.
Using the spreadsheet above, a few things will automatically happen:
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’,
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: