PHP/WP coding standards for codecanyon items. Which one?

Hi, does anybody know what is the official code formatting standard which all PHP files should have on codecanyon? I need to know to configure my automatic code formatter.

I assume that is PSR-2 for PHP files.

And WP standards for WordPress plugins:

Is is true? Is there another one?

In which order (priority)? Especially for WP plugins…

Write your code how you want, as long as it’s secure. Spaces, tabs, single quotes, double quotes, who cares? :stuck_out_tongue:

Use PSR-4 for small PHP scripts and libraries to avoid an easy rejection. Bigger applications don’t need to do this but it’s still probably a good idea.

For WordPress make sure you’re using their provided functions to escape all user input, handle db transactions, add scripts and stylesheets, etc. Don’t make your own function if WP already has one that does the same thing.

2 Likes