I’m rewording this because, as it’s correctly been pointed out, the original post was “woefully inadequate.” I made a plugin which has tabbed views for the various settings. It’s...
It’s probably more of a PHP question, but I would like to know if there are any differences in using global $post; echo $post->ID; when compared to echo $GLOBALS['post']->ID;...
I am using phpcs to help with making sure I write nice, valid WP theme code but am coming across the following issue regarding escaping before output. If I...
I have an issue with custom widgets and WordPress Coding Standards. When you create a custom widget, your class should have a “widget” method that will display the widget....
WordPress-Coding-Standards reports that “Usage of a direct database call is discouraged.” It’s complaining about my usage of $wpdb->insert() in a plugin. Is this not recommended? What is the correct...
Reading the WordPress PHP Documentation Standards, I can’t see anywhere that mentions how to document a function call such as add_action( 'foo', 'bar' ); Should I be documenting function...
In WordPress’ core code, you often see this: if (1 == $someVar) as opposed to this: if ($someVar == 1) I don’t know if the first way is a...
I want to state very clearly that this does not intend to revive the discussion about functional/procedural programming versus object-oriented programming. There is plenty said about that, on WPSE...
When developing themes and plugins it is sometimes neccesary to add some functionality to some hook using conditional statements. Example: function my_custom_function() { if( is_home()) { <---what should the...
I’m in the process of writing a plugin and I’m trying to gauge when to use different approaches of handling errors. There are three methods I’m considering: Throwing an...