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.
No more misspelling of WordPress. 馃檪
Comments
24 responses to “Spelling WordPress Always Correctly”
Obviously, you do not use the snipplet in this article: “…which forces WordPress into WordPress across all…” 馃槈
We dont use it, but that little script shows how easy it is to modify WordPress.
str_ireplace is PHP5 only. For a solution that also works in php4, do :
preg_replace(‘/wordpress/i’, ‘WordPress’, $content);
(untested)
Thanks Wesley, post updated.
Does either the php5, or php4 version affect url’s?
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.
[…] If you like to do things manually, you can add the code manually, as WPEngineer shows in “Spelling WordPress Always Correctly”. […]
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.
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’.
That would make Matt a happy boy.
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.
Michael, thanks for this! I’ve been looking for a way to do something similar for one of my plugins. – Chris
Claudius, thats correct.
[…] Uma outra solu莽茫o, mais discreta e minimalista, 茅 incluir o c贸digo abaixo no arquivo functions.php do seu tema (caso o arquivo n茫o exista, crie-o). Funciona s贸 em servidores que rodem PHP 5, e os cr茅ditos v茫o para o WP Engineer: […]
[…] will, kann auch händisch ein Codesnippet in sein Theme einfügen, dass bei den WP-Engineers zu haben […]
[…] it really such a bad thing to standardize on the name? As Michael points out at WP Engineer, it is a trademark and it should always be presented correctly but should Matt and the boys at […]
[…] la pensate com Matt o per motivi vostri volete arrivare anche voi a questo risultato, su WpEngineer ho trovato questo codice da aggiungere al nostro […]
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!
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.
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?
Richard, not that i know.
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?
vajay, i prefer to PHP5.
#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);