There are two main situations when bad code can hurt a site’s rankings: when publishers make changes to already existing sites, and when sites are developed from the start carelessly.
Some sites (usually blogs), may stop doing well in search, commonly after minor site adjustments like: adding new widgets, plugins or rich-media files. These additions could break the code, making it impossible for search engines to crawl the site.
The easiest way to avoid any such problems is to develop sites that respect Google’s guidelines for Flash and rich media, and Google’s technical guidelines.
Some special tips for WordPress users:
As I already mentioned, adding widgets and plugins could change page code, or even break it, and the result is almost always lower performance in search engines.
A plugin known to cause problems is What Would Seth Godin Do (WWSGD). This plugin adds a text that encourages new visitors to a blog to sign up as an RSS subscriber. If you set the plugin to add this welcome message before the first paragraph of a blog entry, its text might be the only thing Google indexes as the “description” of the page it appears on. The plugin deactivates the welcome text after a certain number of returning visits, but Google’s crawler will be seen by the plugin every time as a new visitor, so you will end up with a series of articles indexed by Google like this:
Google’s bot is smart enough to read the rest of the text and the site gets indexed, but the search engine ranking will be mediocre at best. If you must have WWSGD on your site, try to add it after the body text of the article.
Sometimes plugins crush the MySQL database (WP Super Cache and Comments Relish have known issues); if your blog remains unavailable for too long (usually a few days) it may be completely de-indexed. Luckily most WP users are able to find resolutions to such problems in due time. For less savvy users, a word of advice: less is more. Don’t add too many widgets, badges, scripts or plugins.
The most dangerous instances, however, are generated by scripts already existent in customizable WP themes; for example scripts that add a tag cloud on every page. Each tag is a link and the more links you have on a page, the lesser its “link juice” value. Some tag clouds display only a limited number of tags to the user, but if you open the “page source” to see the code you can sometimes see a clutter of hundreds of tags. This clutter creates pages that are too big, load extremely slowly and can cause crawl problems.
For news publishers (indexed by Google News), these crawl problems appear as “article too long” or “article fragmented” and “page too large” (pages can only be 256KB long) and lead to total de-indexing. Other publishers are not affected, but their SE rankings remain low (a possible solution is to install a plugin that adds rel=”nofollow” to tags). A known theme that can generate such problems is WP Magazine (click on any article title on the demo site and look at the source code).
I hope these few examples give you an idea of how important good coding is for a site’s SE success. If you know of any other instances when bad nested code hurts website publishers and search engine rankings, please let us know.