WordPress Website Architecture Guide for SEO


WordPress is the most widely used blogging platform and I have been using it for god knows how long. Though it is an awesome CMS but then like any other CMS can be prone to errors and bugs.

I have faced several issues with wordpress over the years and have documented solutions to the issues which pop up time and again so that I don’t need to search each and every forum on the web or consult a developer every time I encounter an issue.

By the time you end up reading this post, you should have a better great understanding of the technical side of wordpress which will help you a lot in an optimizing a WordPress website for SEO.


Understanding the WordPress Site Architecture

Half of the wordpress optimization battle is won if we know what we are doing in the first place and understand its consequences.

Therefore it is imperative to understand how a wordpress site works and is structured. Without this knowledge you will have a hard time troubleshooting any wordpress issue.

Wordpress Site Architecture

Every wordpress installation comes with a default theme.

You can either use this theme or you can use a custom theme. In either case,

A wordpress theme consist of template files, style sheet files, javascript files, image files and some other files like functions.php.

All these files work together to create the design and functionality of your wordpress website.

All the wordpress themes’ files live in the folder: /wp-content/themes/.

For e.g. all the files associate with the theme named ‘mystique’ resides in the folder: /wp-content/themes/mystique/

Template files are PHP files (.php) which are used to generate web pages and which makes customization possible in wordpress.

The more template files your theme has got, the more customization you can do.

Some template files are used on all the web pages (like header and footer template file), while others are used only under specific conditions.

WordPress decides which template files to load when, according to the template hierarchy rules.

Note: The actual name of a template file can vary depending upon the theme you are using.


Understanding the functionality of the most common template files used in WordPress

Following are some of the commonly used WordPress template files which you must be aware of:


  1. This file display headers and navigation.
  2. If you want to make changes to the head section(<head>…</head> of each web page (like adding the Google Analytics Tracking Code or other tracking code etc) then you need to edit this file.
  3. You can edit the file by going to your WordPress Admin Panel > Appearance > Editor > header.php


  1. This template file is used to display the blog post index.
  2. The blog post index contains a loop (bunch of PHP code) which displays the most recent blog posts according to some predefined conditions. It displays a list of posts in excerpt or full-length form.
  3. The blog post index can be set to display on the front page of your website or on a separate static page.
  4. You can edit this file via your wordpress admin panel > Appearance > Editor > index.php or Settings > Reading.


  1. This template file can also be used to display the blog post index.
  2. The blog post index can be set to display on the front page of your website or on a separate static page.
  3. If this file is missing then wordpress looks for a file called index.php in the active theme’s directory & uses that template to display the blog post index.


  1. This template file displays your website’s front Page (which is usually called the home page). The front page can be a static page or a blog posts index.
  2. WordPress searches for this file first when you load the front page of your wordpress website. If this file is missing then wordpress looks for a file called home.php. If home.php is also missing then wordpress looks for a file called index.php and uses that template to display the front page of your website.


  1. This template file displays page title and its contents.
  2. If you are a logged in user with ‘edit’ permission than this file displays the ‘Edit’ link through which you can edit the contents of a page.
  3. It also display comment list and comment form.


The template file displays:

  1. blog post’s title
  2. blog post’s content
  3. author name
  4. date of the post
  5. post category & tags
  6. comment list
  7. comment form
  8. Navigation links to the previous and next posts.
  9. If you are a logged in user with ‘edit’ permission than this file displays the ‘Edit’ link through which you can edit the contents of your blog post.


 This template file controls how categories should be displayed.


This template file controls how an author page should be displayed


  1. This template file controls how a search result page should be displayed .
  2. It can display list of posts in excerpt or full length form.
  3. Edit this file if you want to customize your search result page.


  1. This template file is used when wordpress cannot find the post or page which is queried.
  2. Edit this file if you want to customize your 404 page.


Edit this file to change the footer of each web page on your site. Many times we need to add tracking code or some javascript just before the </body> tag or edit footer links. Use this file for such purpose.


This template file decides how the comments should be displayed. It also displays trackbacks, pingbacks & gravatars.


  1. This is the main style sheet file of your wordpress theme and is used to control the design and layout of your web pages.
  2. You can also edit this file to change the theme name, author name or author URL.


  1. This template file is used to control the sidebar display.
  2. You can set up the contents of the sidebar widgets through the WordPress admin panel.


  1. This file is used to add your own custom features to your theme. It works like a plug-in file.
  2. Since this file is theme specific, you lose the custom functionality once you change your theme.
  3. Not all wordpress themes use this file.
  4. If this file doesn’t come with your theme, then you can create it under the wp-content/themes/yourThemeFolder and add PHP functions to it.


Understanding the functionality of WordPress installation files & folders

These are the files which are unique to a particular wordpress installation and contain all of your website data.

So if you want to take a backup of your WordPress website then take backup of the following installation files and folders.


This folder contains all of your plug-ins and themes. It also contains all of your blog posts and comments (in the ‘cache’ sub-folder). So if you want to take a back up of your wordpress site then first take a back up of this folder.


This file stores your database information like database name, database username, database password etc. It is a very important file and can easily take down your website. So don’t mess with it unless you know what you are doing.


Another important file for server access control. You can find this file in the root folder via your FTP. It is a very important file and can easily take down your website. So don’t mess with it unless you know what you are doing.


This is your website favicon file. You can find this file in the root folder via your FTP.


Do we need an explanation here?

Now let us move to the advanced stuff, the practical side of things and determine how this knowledge can be used to troubleshoot WordPress issues.

Here I present to you the most common wordpress issues I have encountered over the years and how I deal with them:


Issue #1- How to fix ‘error establishing a database connection’ in wordpress?

This error occurs when you change your database password but do not update your wp-config.php file or vice versa.

Solution: If you change your database password then you also need to update your wp-config.php file (which is located in the root directory /html in FTP file manager).

If you don’t update your wp-config.php file then you will get the error message ‘error establishing a database connection’.

Open your ‘wp-config.php’ file via FTP and locate the section that looks like this example:

/* The name of the database for WordPress */
define(‘DB_NAME’, ‘putyourdbnamehere’);
/* MySQL database username /
define(‘DB_USER’, ‘usernamehere’);
/* MySQL database password /
define(‘DB_PASSWORD’, ‘yourpasswordhere’); <=Update your database password here
/* MySQL hostname */
define(‘DB_HOST’, ‘localhost’);


Issue #2 : How to fix the error: “It looks like this is a web page, not a feed”?

I have got this error several times. This error usually occurs when permalinks stop working properly.

Solution: To make the permalinks work again: Go to your wordpress admin panel > Settings > Permalinks > click on ‘save changes’ button.


Issue #3: RSS feed is showing only one item

Solution- Make sure that the feed URL (like http://www.optimizesmart.com/feed/) is correct.

If the feed URL is correct but still your feed is showing only one item, then make sure that your feed is a valid feed via feedvalidator.com


Issue #4: WordPress plugin doesn’t work and you can’t remove it through admin panel

Solution- You need to remove the wordpress plug-in via your FTP. Follow the steps below:

1. Access the FTP of your website
2. Locate the folder ‘wp-content’
3. Look for the folder ‘plugins’ and then open it.
4. Select the plugin folder you want to delete and then right click on it.
5. Choose ‘delete’ from the drop down menu.


Issue #5: You can’t fix the issue with your current wordpress theme & can’t remove it via your admin panel

Solution- You need to remove the wordpress theme via your FTP. Follow the steps below:

1. Access the FTP of your website
2. Locate the folder ‘wp-content’
3. Look for the folder ‘themes’ and then open it.
4. Select the theme folder you want to delete and then right click on it.
5. Choose ‘delete’ from the drop down menu.


Issue #6: Optimizing the speed of your wordpress site

Solution: There are lots of things you can do to optimize the speed of your wordpress site. But it can be really time consuming.

So if you are short of time and you just want a switch which can dramatically improve the speed of your website then install the W3 Total Cache Plugin.

It is one of the highest rated and most useful wordpress plug-in ever developed. It can dramatically improve your website speed.


Issue #7: Optimizing pages of your wordpress website for SEO

Solution: I have used several plug-ins for this purpose but the one which stands out all the time is the Yoast WordPress SEO Plugin.

This all-in-one SEO plug-in gives you control over title tags, meta tags, canonical, 404 errors, rich snippets and tons of other wordpress features. I use this plugin for this website.


Issue #8: Removing malware from your wordpress website

Solution: This is one of the most common and serious issue we wordpress users face. Here is what I do to keep my website malware free:

1. Use code gaurd. This tool keeps track of all the changes made to your website. If this tool notice that the change in code (like changes to the .htaccess file) can harm the normal functioning of your website, then it sends you an alert. It takes hourly, daily and monthly back up of your website. I use this tool. 

2. Always keep your wordpress version, plugins and them up to date. Upgrade to the latest version. Every new version comes with a security patch and make your website more secure.

3. Take weekly back up of your website.

4. Be cautious while installing a plug-in or a theme. Sometimes plug-ins/themes contain a malicious code which can harm your website.

5. Scan all your documents/softwares for malware before you make them available for download.

6. Only link out to reputed websites as some websites host malware.

7. Use only reputable advertisers as they are generally malware free.

8. Monitor user generated areas of your website like comments section. Un-moderated comments can have links to malicious websites/files.


To learn more about removing malware from your wordpress website, check out this post:
 Malware Removal Checklist for WordPress – DIY Security Guide


Must have WordPress Plugins

I am not a big fan of plug-ins because they tend to slow down a website. But there are some plug-ins which are so useful that i can’t think of running a site without them. Following is the list of must have plug-ins:

1. Akismet - It protects your blog from comment and trackback spam. Without this plugin you will be bombarded with spam sooner than later.

 2. PS Disable Auto Formatting - It disables wordpress auto formatting by disabling the function ‘auto formatting (wpautop)’ and save <p> and <br /> formatted content. You need this plug-in to get a control on your blog post formating.

 3. W3 Total Cache Plugin – It dramatically improves your website speed and is highly recommended.

 4. WP-touch – It automatically transforms your blog into an iphone application style theme. A must have plug-in if you want your visitors to read your blog through smart phones.

 5. Yoast WordPress SEO Plugin- You need this plugin to easily optimize your wordpress site pages for SEO. Another must have plug-in.


Other Posts you may find interesting:


About the Author:

My business thrives on referrals, so I really appreciate recommendations to people who would benefit from my help.Please feel free to endorse/forward my LinkedIn Profile to your clients, colleagues, friends and others you feel would benefit from PPC, Web Analytics or Conversion Optimization.

For any question/comment Contact me



28 Responses to WordPress Website Architecture Guide for SEO

  1. Jonny Ross says:


    Great idea for a blog post! Don’t think I have seen anything that goes through some of the basics as well as this!!

    Thanks for the cache and code guard idea too!!

    Do you have a list of other plugins your recommend?


    Ps I have tried to post this comment a number of times but it keeps saying error, maybe your post is too short…I am guessing this is putting people off posting… I have only written the ps to see if writing more will solve the problem…

    I have just switched to your full site (I am on an iPhone using your mobile theme) and it seems to be working. So guessing the issue is with the mobile theme or maybe the spam protection which isn’t visible on the mobile theme.

    • Himanshu says:

      Thanks for the heads up Jonny. There is an issue with my mobile theme and i am working on it. I just found your comments in my spam box and that sucks. Now i think i need to look at my spam box everyday because lot of good comments are marked as spam, i don’t know why. I am going to add the list of plugins I highly recommend to my post. Thank you for stopping by my blog. Really appreciate it and sorry for the inconvenience.

  2. Joana says:

    Nice post. No doubt wordpress is by far the best CMS for any blog. It has always been my favorite. Thanks for your Ninja tips. Much appreciated.

  3. odlasb says:

    Thanks for the information Himanshu. Nice explanation and very informative.Now i have got some solutions to my wordpress issues.

  4. David says:

    Wow. It an awesome post. In fact i was on a look out for a good write up on this subject. Even checked the official wordpress documentation. Buy you have explained the topic much better. Are you also planning to write a SEO guide for wordpress?

  5. Mridul Sharma says:

    Thanks for recommending ‘SEO Ultimate’. I was looking for all in one seo pack for the last few weeks. okay what are the things that i need to consider when optimising my blog for wordpress?

    • Himanshu says:

      Your question is very generic. Optimizing a wordpress website is no different than optimizing any other website for SEO. We follow the same on page optimization rules like keywords in the title tags, URLs etc.

  6. automatic updates don't work says:

    Hi there! I have been re-developing a website for a client and i tried to automatically update some wordpress plugins. But towards the end of the update process, the update fails for no apparent reason. What should i do to resolve this issue. Thanks

    • Himanshu says:

      Which version of wordpress are you using? Earlier versions may have some bugs which prevent automatic updates from working properly. Switch to the latest version of wordpress i.e.wordpress 3.3.1 If you already have the latest version then try to upgrade your plugins manually via FTP. If everything else fails then install a fresh copy of wordpress.

  7. I was curious to know what wordpress plugins famous SEOs use. I am currently using the ‘All in One SEO Pack’. I will try SEO ultimate and will let you know how it goes. Can you recommend a best SEO plugin for Excel?

  8. Keith says:

    I would like to double the comment about the W3 Total Cache Plugin. Until I found that plugin and started being able to quickly empty my cache I had to wait for ever to see if the changes I made looked right on the live site. Saved what little hair I have left. One of the things I continue to hope for is a best of breed social sharing plugin but each of them I have tried so far have one or two shortcomings.

  9. Greg says:

    We’re using the Yoast plugin for SEO and have been real happy with it so far… http://yoast.com/wordpress/seo/

    Thanks for a GREAT tutorial! Bookmarked for future reference.

  10. Good informative post Himanshu. I hear you on WP plugins. I have been having trouble with some plugins with the new version of WP. Def better to stick to just a handful of the most useful/reliable plugins.

    PS. Did you already copyright your site until 2021 :)

  11. Would love to see you test my WordPress SEO plugin and give me a rundown of which plugin you like best and why :)

  12. Miguel says:

    Great post. I think it is a metod to learn wordpress very fast

  13. Abel Pardo says:

    Congratulations by this informative post. I also believe that a good charge speed can modify not just SEO, but a whole visitor experience. Most of times it’s better to choose a fast hosting that a couple of links.

    Thank you for sharing this good content, very condensed by very helpful.

    Best regards, Himanshu

  14. Don Tai says:

    Thanks for this informative post. This has helped me clarify all of WordPress’ template file parts, and where to make changes.

  15. Chintak says:

    I can tell, i have not read so detailed article on wordpress architecture anywhere. wonderful.thanks.

  16. misterkel says:

    Thanks for the article. Can you tell me how to access these files? I use WordPress online, multi-site. I can only access things through the admin menu.

  17. Rajeev Barde says:

    Thanks Himanshu ! That was quick & easy explanation.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">