how to disable stopword filtering of URLs in wordpress seo plugin

There are many different Wordpress plugin that help you with the SEO of your website or blog. There are some that handle just one part of the SEO such as meta tags or description and then there are other which takes an all in one approach to SEO. Wordpress SEO by Yoast is one of the plugins that I use on this blog, that manages much of the different SEO factors and also provides a good content analysis feature.

One of the features that Wordpress SEO plugin has is the ability rewrite the post URLs (or permalinks) to better conform to best practice SEO guidelines. It uses a predefined set of stopwords and rewrites the default URL by eliminating the stopwords in the URL.

Stopwords is the term used to denote a set of words that are considered immaterial to the search engine indexing and ranking. These contain words such as a, an, in, the, is, at etc among many others. These words are removed while indexing by some or all search engines and are not believed to have no effect on the ranking.

Having said that, I am not a big proponent of stopword removal from the URL or the title or any text for that matter. There are some reasons for this, some of which you might agree with and maybe some not so much.

So coming back to the plugin, unfortunately there is no configuration option turn this feature off (or on) in the plugin settings. Depending on the nature of the website and the particular blog post itself, you might want to keep the stopwords in the URL.

Workaround

You can get the plugin to "think" that you have manually overridden and set the URL. This will actually cause the plugin to not overwrite it again. In order to do so, click on the Permalink in order edit the link manually or click on the Edit button next to it. Then make a small change somewhere and click OK.

This should cause the URL to stick most of the time. Click on Save Draft to verify that the URL is not being changed. In case it does not work, Click edit again and repeat the process.

Turn it Off (in the code)

Having to remember the workaround every single time is a hassle, so we need to make it permanent. This is simple enough that you can actually do it from the Wordpress admin interface, even though you will need to use the textarea editor.

  1. In Wordpress Admin Dashboard, Click on Plugins
  2. In submenu, Click on Editor to open textarea editor
  3. Click on the dropdown on the top right hand side of the screen and select Wordpress SEO as the plugin to edit
  4. Click on the Select button, which will display all the files of the plugin
  5. On the right side column under Plugin Files, Select *wordpress-seo/admin/class-admin.php *file. The file content will be displayed inside the text area.
  6. Scroll down the file and find function remove_stopwords_from_slug( $slug )
  7. Inside the function, look for the line of code which looks like : $clean_slug_array = array_diff( explode( '-', $clean_slug ), $this->stopwords() );
  8. Make the change in the code as shown below. ie. Replace $this->stopwords()  with array()
  9. Click Update File button to save changes

Old Code:

$clean_slug_array = array_diff( explode( '-', $clean_slug ), $this->stopwords() );

to

New Code:

$clean_slug_array = array_diff( explode( '-', $clean_slug ), array() );
wordpress-seo-stopwords.png

You should now be able to use the Wordpress SEO plugin along with the default Wordpress generated URL. This is not to say that a option to disable the feature will not appear in the future releases of the plugin. This was written as of the plugin version 1.4.15. If you are using a later version, then make sure that the disable option is not already provided.