I talk a lot of WordPress functions , sometimes I say up too, but I'm passionate about these small pieces of code that work wonders in WordPress .
In the case of plugins many times when it is necessary to include a " call "to his duties on the subject , and many readers are unsure how to do this correctly.
And, although instruction files plugins almost always said as inclusion, almost never explains the right way to do it , assuming that users already know how.
I mean, I normally get the typical function of the type:
But it turns out that's not the right way to do it because they assume that we will always use your plugin, and the associated function, and it is not.
The correct way to do this is to add a conditional , so that if the said plugin is currently enabled to do its job, and it did not shred the issue with codes that do not run over anything and give errors.
The correct pattern to follow would be this:
That is, for the above example would look like:
This is true whether you are a user of plugins like - especially - if you want to develop themes and plugins include support , something very common, for example, when a subject natively support utilities as popular as PostNavi plugin.
0 comments:
Post a Comment