The Advanced
Guide to SEO

Chapter 04

By Neil Patel
Sujan Patel

We've been covering some best practice techniques for optimizing your website. But now we're going to get a little more specific and dive into WordPress. Its the most used CMS in the world. I know for a fact most of my readers use WordPress. So I wanted to give you some advanced tips for using it more effectively.

Advanced Indexation For WordPress Sites (Yoast SEO)

Most people usually get the basics done well when settings up WordPress. However, in this section we're going to walk step by step through all of the settings in Yoast SEO, and go over exactly what you want to use them for — and their most common applications.

Note: Some of the options that appear in Yoast's settings depend on what theme you are running. I'm demonstrating on a basic free wordpress theme, but some of the options you see may be slightly different.

General Settings

Title settings

you only need to check this box if for some reason your title tag settings are not working

Site-wide meta tags

you should typically only check of "no-index sub-pages of archives"

Clean up the <head> - you usually don't need to check these off.

Advanced Indexation For WordPress Sites (Yoast SEO) #1

Post Type Settings

This section is not only where you set up title and description templates, but also how you control indexation of these parts of WordPress.

You DO want to let both pages and posts get indexed. It is very rare to not index these.

You do NOT usually want to index media.

Advanced Indexation For WordPress Sites (Yoast SEO) #2



you'll most often want to index these


more and more these should not be indexed. Google doesn't return them as much in results as they used to and it's always better to rank a page, post or category instead.


it's usually safe to leave this unchecked.

Advanced Indexation For WordPress Sites (Yoast SEO) #3


Author Archives

it's best to NOT index these. Also, if you are running a single author blog you should disable them. Users will get redirected back to your home blog page.

Date Archives

its also best to NOT index these, but you should usually keep them enabled. Enabled just means users can browse posts by date.

Advanced Indexation For WordPress Sites (Yoast SEO) #4

XML Sitemap Settings

Note: Be sure you are NOT using another XML sitemap plugin or that your theme does not have this functionality activated.


You can ping both yahoo and I

Exclude Post Types

You should exclude any you're not indexing. Put another way: check off the boxes of pages you are not indexing.

Advanced Indexation For WordPress Sites (Yoast SEO) #5

Category Descriptions

In Yoast, you will have set up a template to display a default category description for the meta tag, like this:

Advanced Indexation For WordPress Sites (Yoast SEO) #6

However, the mistake many people make is not writing this description in the first place! You have to go to Posts > Categories — and when you add a new category the description area then becomes the meta description set up in Yoast SEO.

Advanced Indexation For WordPress Sites (Yoast SEO) #7

Edit .htaccess File

Also, all of the .htaccess methods given throughout this guide can be implemented within Yoast SEO. You go to edit files — and most often your additional code will go at the bottom:

Advanced Indexation For WordPress Sites (Yoast SEO) #8

Securing WordPress

Although not specifically SEO related, perhaps nothing can be more damaging to a website's bottom line than a security problem. SEO is great but only when your site is secure.

Because of this I want to show you some extra security measures you can take in WordPress. They are a little code intensive, so if you are not comfortable doing the following things, please get extra help. But anyone somewhat comfortable with technical things should be able to do these.

  1. Change Your File Permissions

    Run the following two commands to change file permissions recursively. You will need shell access to the server.

    This is for directories;

    find /path/to/your/wordpress/install/ -type d -exec chmod 755 {} \;

    This is for files;

    find /path/to/your/wordpress/install/ -type f -exec chmod 644 {} \;
  2. Secure WordPress Includes

    You're going to need access to your .htaccess file to do this. Again, please use care and if you feel like you need help, try it on a test site or get someone to assist you.

    Add this code above # Begin WordPress

    Like this;

    # Block the include-only files.
    RewriteEngine On
    RewriteBase /
    RewriteRule ^wp-admin/includes/ - [F,L]
    RewriteRule !^wp-includes/ - [S=3]
    RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
    RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
    RewriteRule ^wp-includes/theme-compat/ - [F,L]
    # BEGIN WordPress

    This blocks outside access to your 'include' file directories.

    NOTE: If you want this to work for a multi-author site remove this line;

    RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
  3. Sure your wp-config.php file

    Did you know wp-config.php is where your username and password is installed? If you used a one-click installation through your web host, you may have never worked directly in the wp-config.php (which you do on a manual install).

    Option A Move wp-config.php up one level

    wp-config.php normally sits in the root directory

    Bit did you know, you can actually move wp-config.php up one level above the root directory. Like this;

    Securing WordPress

    Option B htaccess file code

    If you don't want to move around files, you can also use this code in the .htaccess file.

    Put this at the very TOP of the .htaccess file.

    <files wp-config.php>
    order allow,deny
    deny from all

    This will block anyone trying to open it with their browser.

Making WordPress Comment Reply Links Nofollow

  1. Go to appearance > editor >functions.php

    Making WordPress Comment Reply Links Nofollow #1
  2. Paste the following code into the very bottom of your functions.php file;

    Making WordPress Comment Reply Links Nofollow #2
  3. Add a rel="nofollow" to the comment reply links

    function add_nofollow_to_reply_link( $link ) {
    	return str_replace( '")\'>', '")\' rel=\'nofollow\'>', $link );
    add_filter( 'comment_reply_link', 'add_nofollow_to_reply_link' );

    It's the str_replace() function which is replacing the default closing of the anchor tag - and its appending the nofollow to it.

    Remember to update the file.

    Making WordPress Comment Reply Links Nofollow #3
  4. And you can always quickly check for followed/unfollowed links with the SEOmoz toolbar;

    Making WordPress Comment Reply Links Nofollow #4

Internal Linking With SEO Smart Links

By now I'm sure you know the importance of "Internal Linking" - that is how you link from page to page within your own website. But what happens with most blog posts? As time goes by, they get further and further away from the homepage and their linkjuice is buried. Unless you consistently link to them from new posts and pages.

This part of the SEO guide is going to show you how to install, configure and use the SEO Smart Links plugin. (More on identifying which pages you should link to below in #24 - Crawling Your Site Screaming Frog.)

For example, in this post from April 9th, 2012, I link back to a post from December 5th, 2011.

Enter "SEO Smart Links" Plugin

Let's walk through a this plugin in detail. It makes internal linking to older posts easy.

Internal Linking With SEO Smart Links #1

Install The Plugin

Go to - http://wordpress.org/extend/plugins/seo-automatic-links/ OR search for "SEO Smart Links" within WordPress and install it within WordPress.


This is where some people can get confused, and I am here to help you out :-)

Internal Linking With SEO Smart Links #2

Choose where links will appear:

  • Posts
  • Pages
  • Prevent links in Headers
Internal Linking With SEO Smart Links #3

Choose Targets and Settings

  • Target Posts only unless you have pages really
    important to you
  • Process only single posts
  • Process RSS Feeds this is a good idea
  • Ignore posts and pages Here you can ask the plugin to NOT link to certain pages or posts.
  • Ignore keywords Here you can also ask it to ignore certain keywords when linking. Internal Linking With SEO Smart Links #4

Next, you'll want to add specific posts that should be linked to when specific keywords appear (perhaps the coolest feature of this plugin).

  • Custom Keywords
  • Prevent duplicate links
  • Enter the keywords and the URL
  • Enter as many keywords as you'd like, comma separated
  • Enter the URL you want those keywords to link to.
  • Do this for every post you want direct control over the links
Internal Linking With SEO Smart Links #5

Lastly, we're going to set limits;

Internal Linking With SEO Smart Links #6


  • Max Links — I like to keep this at 5 for the typical length of my posts.
  • Max Single — 1
  • Max Single URLs — 1

External Links

  • Nofollow — this is not necessary to enable
  • Open in new window — I like this for the user experience, and they are more likely to navigate back to your site.

Internal Linking {A Few Bonus Tips}

If you're doing some manual internal linking, here's some important tips to keep in mind;

Link from the snippet or from the top of the post — this way (for a short period of time) your links will be on your homepage, and send important authority back to your older posts.

The link closest to the top gets the most linkjuice.

User testing has shown people are more likely to click on links with about seven words in the anchor text.

Get Rid of Date in SERPS / WordPress

People have often asked me how to remove the date from displaying in a Google search result when running on WordPress. It is often not desirable to have the date shown, as in the example below.

Get Rid of Date in SERPS / WordPress #1

Finding And Replacing the_time() Function

The hardest part about this perhaps, is finding the right spot in your WordPress setup to alter the code. The function we're looking for is 'the_time()'.

The three most common places you will the_time() are;

  • archive.php
  • index.php
  • single.php

How To Search Your WordPress Files

  1. Use an FTP client like Filezilla

  2. Download your wordpress theme files to your local computer (you should do this anyway sometimes as a backup)

    Be sure to not copy the entire wordpress installation — just copy the folder wp-content/themes/your-active-theme-folder

  3. Search multiple files with a text editor like Textwrangler

    Go to Search->Multi-File Search...

    Get Rid of Date in SERPS / WordPress #2

    Enter 'the_date' in the find field
    Click other - navigate to your theme's folder and select

    Your dialogue and selections should look similar to the one below, with only the theme name differing.

    Get Rid of Date in SERPS / WordPress #3

    You will see a result listing all of the files that contain 'the_time'. These are the files you should edit directly in the WordPress editor.

    Get Rid of Date in SERPS / WordPress #4

    Alter the_time() In All Of Those Files

    It will probably look something like this;

    <?php the_time('F jS, Y') ?>

    Replace it with this:

    <script language="javascript" type="text/javascript">document.write("<?php the_time('F jS, Y') ?>");</script>

    How it works: We're wrapping the PHP function int Javascript. Google does not use javascript when pulling data for the description. So it will display for the user but not read by Google.

Creating a Custom WordPress Author Bio Page

The default "author archive" in WordPress is just a list of all the posts by that author. For my site, you can see that my author page http://www.quicksprout.com/author/admin/ is simply as list of the posts I have written, which I why I choose to not index it.

Custom author pages work best on multi-author blogs. If you are running a single author site, simply having an "about" page may be the better option for you. So this tutorial is going to assume you are running a multi-author site.

These are the five steps:

File Setup

The file you need to edit is author.php

Go to appearance > Editor and look for author.php

The default themes, twentyeleven and twentyten have an author.php file

Creating a Custom WordPress Author Bio Page #1

If it DOES exist, that's the file we're going to edit make a backup copy now.

If it does NOT exist
make a copy of archive.php
rename it author.php

Lastly, we're going to clean it out to prep for editing:

Open your new version of author.php in your text editor (if you're really brave you can do all the editing in the appearance editor, but I don't recommend it).

Delete from between get_header() & get_sidebar()

Creating a Custom WordPress Author Bio Page #2

Current Author Detection

Next we have to put some code in to detect the current author - here's the code:

	$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) :
Creating a Custom WordPress Author Bio Page #3

Rough Draft

This isn't so technical, but I recommend sketching out a little rough draft of the layout of your author page. This makes it easier to set up your variables. You can do so within the text editor itself.

This is just a great way to get the idea of how you way to display the info in there before entering the code.

Creating a Custom WordPress Author Bio Page #4


Next, based upon the info you'd like to display, you can grab the variables we'll need to build the code.

Here's a list of all of the author variables:

  • $curauth->aim;
  • $curauth->description;
  • $curauth->display_name;
  • $curauth->first_name;
  • $curauth->ID;
  • $curauth->jabber;
  • $curauth->last_name;
  • $curauth->nickname;
  • $curauth->user_email;
  • $curauth->user_login;
  • $curauth->user_nicename;
  • $curauth->user_registered;
  • $curauth->user_url;
  • $curauth->yim;

The ones we'll need are;

  • $curauth->nickname; (most often used to display the name, you can use displayname too)
  • $curauth->user_url;
  • $curauth->user_description;

Putting It Together

Note: Your exact HTML and CSS styling will probably be a little different then this example. This is just one example of a variety of ways you could build it

You're first going to put your author bio information
this is just an example.

Creating a Custom WordPress Author Bio Page #5

If you're comfortable with HTML, adding the variables it easy.

If what you want to display is:

<h2>About: Neil Patel</h2>

You just replace the actual name with the variable and the php wrapper. So Neil Patel gets replaced with <?php echo $curauth->nickname; ?> like this:

<h2>About: <?php echo $curauth->nickname; ?></h2>

and the whole code sample is:

<h2>About: <?php echo $curauth->nickname; ?></h2>
   <dd><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></dd>
   <dd><?php echo $curauth->user_description; ?></dd>

Then we're going to start the loop and get the posts in there
here's what the code looks like and some explanation:

Creating a Custom WordPress Author Bio Page #6

Just like with the above section — you write the HTML but then place in the WordPress variables.

The Complete Code Sample

Here's the complete author.php file. Remember, parts of it may need to change slightly to match your theme!

<?php get_header(); ?>

	$curauth = (isset($_GET['author_name'])) ? get_user_by('slug',
	$author_name) : get_userdata(intval($author));

<!--Author Bio Box-->

<h2>About: <?php echo $curauth->nickname; ?></h2>
	<dd><a href="<?php echo $curauth->user_url; ?>">
	<?php echo $curauth->user_url; ?></a></dd>
	<dd><?php echo $curauth->user_description; ?></dd>

<h2>Posts by <?php echo $curauth->nickname; ?>:</h2>

	<!-- The Loop -->

	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
	<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: 
	<?php the_title(); ?>"><?php the_title(); ?></a>,
	<?php the_time('d M Y'); ?> in <?php the_category('&');?>

	<?php endwhile; else: ?>
	<p><?php _e('No posts by this author.'); ?></p>

	<?php endif; ?>

	<!-- End Loop -->


<?php get_sidebar(); ?>
<?php get_footer(); ?>

Using WP-Super Cache

WP Super Cache generates static HTML pages to serve up instead of hefty PHP files. This improves the speed of your site significantly. Correct setup is not always immediately obvious, especially for first time users. So we're going to walk through the best practice configuration for this great time saving plugin.

If you want the documentation for the plugin you can view the WordPress page for it here - http://wordpress.org/extend/plugins/wp-super-cache/

There are several similarly named plugins, so when you choose it in the plugin installer, make sure you choose the correct one;

Using WP-Super Cache #1

Once installed and activated there are a few tabs with important settings, we're going to walk through the steps.

If you have trouble finding it, go to settings > WP Super Cache

Using WP-Super Cache #2

Tab One — Easy

Just like it says, this tab is "easy"! All you need to do is turn on caching.

Using WP-Super Cache #3

Tab Two — Advanced: Choose Settings

Select the following options;

  • Cache hits to this website for quick access
  • Use PHP to serve cache files
  • Compress pages so they're served more quickly to visitors
  • Don't cache pages for known users
  • Cache rebuild
  • Mobile device support
  • Extra homepage checks
Using WP-Super Cache #4

Check That Caching Is Working

At this point, before continuing, you may want to check to see that caching is working properly. You should also periodically visit your website during any plugin setup and configuration to be sure it hasn't broken anything.

To check caching

  1. Visit a page on your site
  2. View Source
  3. Scroll all the way to the bottom
  4. And look for the WP Super Caching comments in your code;
Using WP-Super Cache #5

Tab Two — Advanced: Setup Garage Collection

Setting the garbage collection controls how often stale or old cached files are thrown out. Simply put;

  • Sites that are updated more often, will need to run garbage collection more often.
  • Sites that are not updated often, don't need to run garbage collection as often.

Explanation of Setting Options

Using WP-Super Cache #6

You have TWO choices for garbage collection;

  • The timer schedules it to run at regular intervals (in seconds). This is for sites that update most frequently
  • The clock runs on a set schedule daily, twice-daily, or hourly. This is for sites that are not updated as often.
  • And you can receive email notifications too.

Let's look at two different setting options.

Sites Serving A Lot of Fresh Data

If you're serving a lot of fresh content, you'll want to empty the trash often and have a short timeout. So you may want to start with the following settings;

Set your timeout to update every minute (60 seconds). Set your timer to run every 90 seconds. This way you're always cleaning out stale cached files as new ones are created. This is a starting point for very frequently updated sites — you should adjust these intervals specific to your situation.

Using WP-Super Cache #7

Sites That Do Not Update As Often

These settings are for sites that might have only one piece of new content a day at the most. Also for sites with no widgets or RSS feeds in the sidebars.

Using WP-Super Cache #8

The setting you see above are for a site that might get one update a day or just a few a week. Set your timeout to 10 days (864000 seconds). Use the clock in this instance, and set it to twice daily and at a time that makes sense for your site. If you typically post new content in the evening, a time of 10:00 might make sense - it will empty garbage just after you've posted your new content at night, and do so once again at 10:00am to keep things clean.

Disabling Garbage Collection

If for whatever reason you want to disable garbage collection, enter ZERO for the timeout.

Using WP-Super Cache #9

Adding Your Site To Entity Based Sources

Although not totally "hands on" we're going to wrap up the WordPress section with the most comprehensive list of valuable plugins I know of, that I personally know work. There are a lot of incomplete lists, or lists that contain sub-par plugins.

Disclaimer: I know these to work at the time of publishing this guide. No guarantees they will work by the time you read this :)

Now you should have a super powered WordPress site! This concludes the last section of on-site optimization techniques. In the next section "Advanced Data Research" we're going to begin our journey of off-site SEO techniques.

Well done! You made it through chapter four! Are you ready for chapter five:
Advanced Data Research?