<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Top 10 Most Common Coding Mistakes in WordPress Plugins</title>
	<atom:link href="http://planetozh.com/blog/2009/09/top-10-most-common-coding-mistakes-in-wordpress-plugins/feed/" rel="self" type="application/rss+xml" />
	<link>http://planetozh.com/blog/2009/09/top-10-most-common-coding-mistakes-in-wordpress-plugins/?source=rss</link>
	<description>A bit of my personal life, mainly focused on my kids. A bit of code, mainly focused on Wordpress and PHP. Overall, bits of nothing in particular.</description>
	<lastBuildDate>Wed, 08 Feb 2012 20:57:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: ray</title>
		<link>http://planetozh.com/blog/2009/09/top-10-most-common-coding-mistakes-in-wordpress-plugins/comment-page-2/#comment-197713</link>
		<dc:creator>ray</dc:creator>
		<pubDate>Tue, 31 Jan 2012 00:01:03 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=1321#comment-197713</guid>
		<description>thanks Ozh,
Don&#039;t always think of all these things when coding so it&#039;s great to get a reminder...</description>
		<content:encoded><![CDATA[<p>thanks Ozh,<br />
Don&#8217;t always think of all these things when coding so it&#8217;s great to get a reminder&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ozh</title>
		<link>http://planetozh.com/blog/2009/09/top-10-most-common-coding-mistakes-in-wordpress-plugins/comment-page-2/#comment-197492</link>
		<dc:creator>Ozh</dc:creator>
		<pubDate>Wed, 04 Jan 2012 13:20:03 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=1321#comment-197492</guid>
		<description>abdussamad » Otto is saying exactly the same as me. Store 10 options in one array instead of saving one in 10 different entries. Regarding serializing, it&#039;s just how WP stores arrays.

Number 7 is still valid. You need to either implement nonces or, preferably, use the API settings, but anyway not use raw forms with no checks.</description>
		<content:encoded><![CDATA[<p>abdussamad » Otto is saying exactly the same as me. Store 10 options in one array instead of saving one in 10 different entries. Regarding serializing, it&#8217;s just how WP stores arrays.</p>
<p>Number 7 is still valid. You need to either implement nonces or, preferably, use the API settings, but anyway not use raw forms with no checks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abdussamad</title>
		<link>http://planetozh.com/blog/2009/09/top-10-most-common-coding-mistakes-in-wordpress-plugins/comment-page-2/#comment-197491</link>
		<dc:creator>abdussamad</dc:creator>
		<pubDate>Wed, 04 Jan 2012 08:14:33 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=1321#comment-197491</guid>
		<description>Regarding 3: According to core developer otto its better to store options as an array. The reason he gives is that it saves on queries to the database:

http://lists.automattic.com/pipermail/wp-testers/2009-January/011116.html

But here you&#039;ve shown the exact opposite. Wordpress simply loads all autoload options with one DB query! So why store data as in serialized form? The memory usage is the same and it still takes just one query. Frankly I think its better to store options in separate rows. Easier to code as well.

Regarding number 7: It&#039;s now redundant with the new settings api. It does all the checking for you.</description>
		<content:encoded><![CDATA[<p>Regarding 3: According to core developer otto its better to store options as an array. The reason he gives is that it saves on queries to the database:</p>
<p><a href="http://lists.automattic.com/pipermail/wp-testers/2009-January/011116.html" rel="nofollow">http://lists.automattic.com/pipermail/wp-testers/2009-January/011116.html</a></p>
<p>But here you&#8217;ve shown the exact opposite. WordPress simply loads all autoload options with one DB query! So why store data as in serialized form? The memory usage is the same and it still takes just one query. Frankly I think its better to store options in separate rows. Easier to code as well.</p>
<p>Regarding number 7: It&#8217;s now redundant with the new settings api. It does all the checking for you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sixeightzero</title>
		<link>http://planetozh.com/blog/2009/09/top-10-most-common-coding-mistakes-in-wordpress-plugins/comment-page-2/#comment-197441</link>
		<dc:creator>sixeightzero</dc:creator>
		<pubDate>Wed, 28 Dec 2011 14:46:22 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=1321#comment-197441</guid>
		<description>Looking forward to using your tips above to make my first plugin for WordPress a success</description>
		<content:encoded><![CDATA[<p>Looking forward to using your tips above to make my first plugin for WordPress a success</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adrian</title>
		<link>http://planetozh.com/blog/2009/09/top-10-most-common-coding-mistakes-in-wordpress-plugins/comment-page-2/#comment-191267</link>
		<dc:creator>adrian</dc:creator>
		<pubDate>Wed, 14 Sep 2011 00:39:32 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=1321#comment-191267</guid>
		<description>I love the WTF/minute unit of measurement. both funny and perfectly correct. 

computers dont care about WTF/minute, but humans do. code for a human. 

a high WTF/min is a sign of a low ego. instead think, of course others will want to maintain my code, its does great things. i have to make it awesome and low WTF/min</description>
		<content:encoded><![CDATA[<p>I love the WTF/minute unit of measurement. both funny and perfectly correct. </p>
<p>computers dont care about WTF/minute, but humans do. code for a human. </p>
<p>a high WTF/min is a sign of a low ego. instead think, of course others will want to maintain my code, its does great things. i have to make it awesome and low WTF/min</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ozh</title>
		<link>http://planetozh.com/blog/2009/09/top-10-most-common-coding-mistakes-in-wordpress-plugins/comment-page-2/#comment-190374</link>
		<dc:creator>Ozh</dc:creator>
		<pubDate>Sun, 11 Sep 2011 10:07:54 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=1321#comment-190374</guid>
		<description>Alex Wheeler » Glad you like it. Now go a step further and have a look at http://planetozh.com/blog/books/professional-wordpress-plugin-development/ :)</description>
		<content:encoded><![CDATA[<p>Alex Wheeler » Glad you like it. Now go a step further and have a look at <a href="http://planetozh.com/blog/books/professional-wordpress-plugin-development/" rel="nofollow">http://planetozh.com/blog/books/professional-wordpress-plugin-development/</a> :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex Wheeler</title>
		<link>http://planetozh.com/blog/2009/09/top-10-most-common-coding-mistakes-in-wordpress-plugins/comment-page-2/#comment-190269</link>
		<dc:creator>Alex Wheeler</dc:creator>
		<pubDate>Sun, 11 Sep 2011 00:55:56 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=1321#comment-190269</guid>
		<description>Hi Ozh,
i am an experienced web developer just getting into WordPress development. I&#039;ve been reading up on plugin development learning the essentials when i stumbled across this article - started reading - and couldn&#039;t stop until i finished every line.

This is a great comprehensive and informative article i found to be very useful. I&#039;ve actually been wondering about a few issues you&#039;ve mentioned, namely the lack of comments in wordpress plugins, throughout my quest to learn WP plugin development. Thanks for the great information, i have a feeling it will save me a lot of time &amp; effort down the road.

- Alex</description>
		<content:encoded><![CDATA[<p>Hi Ozh,<br />
i am an experienced web developer just getting into WordPress development. I&#8217;ve been reading up on plugin development learning the essentials when i stumbled across this article &#8211; started reading &#8211; and couldn&#8217;t stop until i finished every line.</p>
<p>This is a great comprehensive and informative article i found to be very useful. I&#8217;ve actually been wondering about a few issues you&#8217;ve mentioned, namely the lack of comments in wordpress plugins, throughout my quest to learn WP plugin development. Thanks for the great information, i have a feeling it will save me a lot of time &amp; effort down the road.</p>
<p>- Alex</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cody</title>
		<link>http://planetozh.com/blog/2009/09/top-10-most-common-coding-mistakes-in-wordpress-plugins/comment-page-2/#comment-188853</link>
		<dc:creator>Cody</dc:creator>
		<pubDate>Tue, 06 Sep 2011 00:37:50 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=1321#comment-188853</guid>
		<description>&quot;Compatibility maintained with deprecated versions of WordPress&quot;

Excellent, excellent points. Thank you so  much for mentioning this! (See below about responsibility). It&#039;s something I think of all the time with any kind of program. Yes, backward compatibility is important in some things, but with something like WordPress - absolutely not. In general, an out of date webserver (and whatever runs on it) is a terrible mistake. 

I must disagree though that it might encourage others to upgrade. Some, it might. But sadly not everyone. Sad especially because security is the responsibility of everyone. Think of Blaster or other worms, for example. And to that end, though, the chance for more to upgrade is excellent and as you also point out it&#039;s a benefit for the developer: easier to maintain. Also, the code will be cleaner by the very fact you don&#039;t have a bunch of hacks/workarounds/etc.

As for comments, well I must admit I&#039;m fairly guilty of that and have been for years. I think the only code I really commented a lot, was assembly. I do comment I just know I should more. Some times I will go back to code and wonder what in the hell I was thinking, or what the code did or what the idea was behind the code. As for indentation - true. But it should be pointed out, of course, that style is also preference. So yes indentation is important, but styles is another matter entirely. I mean, look at the C language: you have K&amp;R style to start with, and then others too. Does a brace to open a block start on the same line or the next? What about a closing brace? For me I even vary it depending on the language. In C++ I tend to do the more traditional on the same line. In java likewise. But in C I usually did the next line, just because I &#039;inherited&#039; that with other projects.

Already way too long so I&#039;ll just end it with this - and it&#039;s in defence of WordPress&#039;s api documentation.

Although I agree that the codex is a bit of a mess or not organized or thorough you have to remember something: WordPress is open source, more or less. This is on people&#039;s free time. So, sure you can complain about the api documentation being out of date or not good enough, but well, why  not fix it or offer to help? Don&#039;t like it? Well that&#039;s just how it goes at times, unfortunately. I&#039;ve worked on projects with over 130k lines of C code and most (ok, all ?) not commented. I worked it out. I added a lot of that code too (figure 20-30k lines in the time I was active). And while this project was not open to all (source wise) it&#039;s still a point: if someone is doing something on their own free time, and if it makes sense to them, that&#039;s what matters - so they can work and continue to work on it. And since it&#039;s not a corporate project, they really don&#039;t have to try to remember to do this or that to save the company money and time.

Some times you do have to get your hands dirty and look at code if you&#039;re a developer. I know, it&#039;s so very shocking and terrifying that a developer would ever have to look at someone else&#039;s code (with or without comments at a level of your liking.. oh the horror of it all!), but... that&#039;s part of being a developer! And you can actually learn a great deal by looking at others code: you can find new ideas, get inspired, you can learn new techniques, and you can learn more about the internals of the project you&#039;re working on. As a friend of mine has said before, programming involves risks and sometimes you will mess up, make a mess or struggle. That&#039;s how it is and all the more power to those who can manage.

Regardless, thanks for this post. I think it could come in handy at times. I don&#039;t do much php (in truth I don&#039;t like it that much compared to others; but I&#039;m more into system programming anyway) but I have written a plugin and a theme (though not public for either). I&#039;ve done most of what you suggested, but there may be something to look at, so thanks.

Cheers,
Cody</description>
		<content:encoded><![CDATA[<p>&#8220;Compatibility maintained with deprecated versions of WordPress&#8221;</p>
<p>Excellent, excellent points. Thank you so  much for mentioning this! (See below about responsibility). It&#8217;s something I think of all the time with any kind of program. Yes, backward compatibility is important in some things, but with something like WordPress &#8211; absolutely not. In general, an out of date webserver (and whatever runs on it) is a terrible mistake. </p>
<p>I must disagree though that it might encourage others to upgrade. Some, it might. But sadly not everyone. Sad especially because security is the responsibility of everyone. Think of Blaster or other worms, for example. And to that end, though, the chance for more to upgrade is excellent and as you also point out it&#8217;s a benefit for the developer: easier to maintain. Also, the code will be cleaner by the very fact you don&#8217;t have a bunch of hacks/workarounds/etc.</p>
<p>As for comments, well I must admit I&#8217;m fairly guilty of that and have been for years. I think the only code I really commented a lot, was assembly. I do comment I just know I should more. Some times I will go back to code and wonder what in the hell I was thinking, or what the code did or what the idea was behind the code. As for indentation &#8211; true. But it should be pointed out, of course, that style is also preference. So yes indentation is important, but styles is another matter entirely. I mean, look at the C language: you have K&amp;R style to start with, and then others too. Does a brace to open a block start on the same line or the next? What about a closing brace? For me I even vary it depending on the language. In C++ I tend to do the more traditional on the same line. In java likewise. But in C I usually did the next line, just because I &#8216;inherited&#8217; that with other projects.</p>
<p>Already way too long so I&#8217;ll just end it with this &#8211; and it&#8217;s in defence of WordPress&#8217;s api documentation.</p>
<p>Although I agree that the codex is a bit of a mess or not organized or thorough you have to remember something: WordPress is open source, more or less. This is on people&#8217;s free time. So, sure you can complain about the api documentation being out of date or not good enough, but well, why  not fix it or offer to help? Don&#8217;t like it? Well that&#8217;s just how it goes at times, unfortunately. I&#8217;ve worked on projects with over 130k lines of C code and most (ok, all ?) not commented. I worked it out. I added a lot of that code too (figure 20-30k lines in the time I was active). And while this project was not open to all (source wise) it&#8217;s still a point: if someone is doing something on their own free time, and if it makes sense to them, that&#8217;s what matters &#8211; so they can work and continue to work on it. And since it&#8217;s not a corporate project, they really don&#8217;t have to try to remember to do this or that to save the company money and time.</p>
<p>Some times you do have to get your hands dirty and look at code if you&#8217;re a developer. I know, it&#8217;s so very shocking and terrifying that a developer would ever have to look at someone else&#8217;s code (with or without comments at a level of your liking.. oh the horror of it all!), but&#8230; that&#8217;s part of being a developer! And you can actually learn a great deal by looking at others code: you can find new ideas, get inspired, you can learn new techniques, and you can learn more about the internals of the project you&#8217;re working on. As a friend of mine has said before, programming involves risks and sometimes you will mess up, make a mess or struggle. That&#8217;s how it is and all the more power to those who can manage.</p>
<p>Regardless, thanks for this post. I think it could come in handy at times. I don&#8217;t do much php (in truth I don&#8217;t like it that much compared to others; but I&#8217;m more into system programming anyway) but I have written a plugin and a theme (though not public for either). I&#8217;ve done most of what you suggested, but there may be something to look at, so thanks.</p>
<p>Cheers,<br />
Cody</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oliver</title>
		<link>http://planetozh.com/blog/2009/09/top-10-most-common-coding-mistakes-in-wordpress-plugins/comment-page-2/#comment-188102</link>
		<dc:creator>Oliver</dc:creator>
		<pubDate>Sat, 03 Sep 2011 21:41:52 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=1321#comment-188102</guid>
		<description>Hello. Great article. But unfortunately my problem is not that kind mentioned in the text above. I am testing a plugin right now called Wikibox, it is able to display a summary of an wikipedia article with this code:



But as you see it is always the same - Pink Floyd. I now like to add a new functionality but don&#039;t know how. I added the_tags instead of Pink Floyd and it looks like this:



But - nothing happens. What I want is, the code should get the tags for the post and should display a summary of every tag (wikipedia article) one after another.

Maybe you can help me out with this. Sorry if it doesn&#039;t match with the content but I desperately need help with this.</description>
		<content:encoded><![CDATA[<p>Hello. Great article. But unfortunately my problem is not that kind mentioned in the text above. I am testing a plugin right now called Wikibox, it is able to display a summary of an wikipedia article with this code:</p>
<p>But as you see it is always the same &#8211; Pink Floyd. I now like to add a new functionality but don&#8217;t know how. I added the_tags instead of Pink Floyd and it looks like this:</p>
<p>But &#8211; nothing happens. What I want is, the code should get the tags for the post and should display a summary of every tag (wikipedia article) one after another.</p>
<p>Maybe you can help me out with this. Sorry if it doesn&#8217;t match with the content but I desperately need help with this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://planetozh.com/blog/2009/09/top-10-most-common-coding-mistakes-in-wordpress-plugins/comment-page-2/#comment-179204</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Wed, 17 Aug 2011 10:30:41 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=1321#comment-179204</guid>
		<description>Wow dude. great article. I am glad there are some people out there that care about neat code that&#039;s logical and simple</description>
		<content:encoded><![CDATA[<p>Wow dude. great article. I am glad there are some people out there that care about neat code that&#8217;s logical and simple</p>
]]></content:encoded>
	</item>
</channel>
</rss>

