Spelling WordPress Always Correctly

Sometimes it happens that you have misspelled WordPress in your article because you were in a rush. Since WordPress is a registered trademark, it should be natural to write WordPress the correct way. As Lorelle mentioned on her blog, Matt wrote a script, which forces WordPress into WordPress across all of the 5 million plus blogs on WordPress.com.

The following code snippet, which has to be insert in function.php, replaces wordpress, WordPress,wOrDPrESS and other spellings of WordPress:
Note: that function is PHP 5 only.

<?php
function writeWordPressCorrect($content) {
	$content = str_ireplace("wordpress","WordPress", $content);
	return $content;
}
add_filter('the_title', 'writeWordPressCorrect',1);
add_filter('the_content', 'writeWordPressCorrect',1);
?>

No more misspelling of WordPress. 🙂

Comments are closed.

24 comments

  1. Stefan Waidele

    Obviously, you do not use the snipplet in this article: "...which forces WordPress into WordPress across all..." 😉

  2. Michael

    We dont use it, but that little script shows how easy it is to modify WordPress.

  3. Wesley

    str_ireplace is PHP5 only. For a solution that also works in php4, do :

    preg_replace('/wordpress/i', 'WordPress', $content);

    (untested)

  4. Michael

    Thanks Wesley, post updated.

  5. Rich Pedley

    Does either the php5, or php4 version affect url's?

  6. Michael

    Rich, str_ireplace is only available in PHP5.
    But mine and Wesley's snippets affects urls in the content and the title, not the permalink.
    But there is no problem, type WordPress.org in your browser and it works 😉

    Another option is to run those filters on saving the post. That saves alot performance.

  7. Frederick

    Indeed, running the filter upon saving the post would save a lot of performance.

    Also, using preg_replace as recommended above is not a suitable replacement for high-traffic sites, since Perl-regular-expression search-and-replace is slower than string search-and-replace... it adds up.

  8. Frederick

    Also, (sorry for the double post), just to point something out. If the function takes an incorrect rendition of 'WordPress' and makes it into the correct 'WordPress', shouldn't the function be a bit more linguistically correct?

    What I mean is, 'writeWordPressCorrect' misuses an adjective in place of an adverb. It should be 'writeWordPressCorrectly'.

  9. WPCult

    That would make Matt a happy boy.

  10. Claudius Coenen

    WordPress.org in your browser and it works

    That's not fully correct. It works for domain-names, which are case-insensitive by definition. But it does not work if someone had wordpress as part of their path and runs a linux/unix server (which are case sensitive when it comes to paths).

    So this is really a difference:

    http://example.com/wordpress
    http://example.com/WordPress

    They will point to different directories or fail to do so.

  11. Christopher Ross

    Michael, thanks for this! I've been looking for a way to do something similar for one of my plugins. - Chris

  12. Michael

    Claudius, thats correct.

  13. Richard

    Interesting function, you could do lots of things with this, like add a plugin function WriteMyPostalAddress
    change " to ' ...('myaddress','your html
    more html
    etc', $content);
    add_filter ..WriteMyPostalAddress

    The question I have is say you do a series of plugin/function/shortcuts like this, is there an overhead?
    or is there any issues with that type of plugin shortcut?

    Is there any additional security or any additional code I should add to this type of simple admin-less plugin?

    As is, my WriteMyPostalAddress test using dreamweaver created wysiwyg table, code just plopped in, works great!

  14. Michael

    Richard: use this kind of functions carefully. Every filter slow down the peformance of your website.
    I don't see any security problems with filters like that.

  15. Richard

    Thanks Michael, so maybe the better bet is using QuickTags when possible.

    Is there a way to show a list of all filters being loaded?

  16. Michael

    Richard, not that i know.

  17. vijay

    I have PHP4 and PHP5 on my server. Which one should I choose for running wordpress?

    And what needs to be changed in the default php.ini file?

  18. Michael

    vajay, i prefer to PHP5.

  19. Andrew C

    #1 - How can I Correct the spelling when I save/publish a post?

    #2 - As you can see (in the code below) I'm only changing the_title and looking for "exclusive" or "mp3" or both. How can I COMBINE this function?

    this is my code:

    # write EXCLUSIVE Correct
    function writeexclusiveCorrect($content) {
    $content = str_ireplace("exclusive","EXCLUSIVE", $content);
    return $content;
    }
    add_filter('the_title', 'writeexclusiveCorrect',1);

    # write MP3 Correct
    function writemp3Correct($content) {
    $content = str_ireplace("mp3","MP3", $content);
    return $content;
    }
    add_filter('the_title', 'writemp3Correct',1);

5 pingbacks

  1. More WordPress Logogate « Lorelle on WordPress
  2. O caso Logogate e a grafia correta do WordPress | pBlog
  3. WordPress Logogate - FirstDayBlack
  4. Google’s now Evil? Is WordPress next? :: Christopher Ross
  5. Come fare: Scrivere bene “WordPress” | Altamente Decorativo