{"id":23292,"date":"2015-02-13T21:01:16","date_gmt":"2015-02-13T13:01:16","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=23292"},"modified":"2025-04-04T02:02:40","modified_gmt":"2025-04-03T18:02:40","slug":"wordpress-coding-standard","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/wordpress-coding-standard\/","title":{"rendered":"WordPress Coding Standards: A Guide for Developers"},"content":{"rendered":"<p>The reason that we have coding standards at all (not just for WordPress) is to <strong>create a familiar environment for programmers<\/strong> working on a project. WordPress in particular encompasses a wide variety of products. From the core itself to <a href=\"https:\/\/www.hongkiat.com\/blog\/tag\/wordpress-themes\/\">themes<\/a> and <a href=\"https:\/\/www.hongkiat.com\/blog\/tag\/wordpress-plugins\/\">plugins<\/a>, there is a lot to look at \u2013 and a lot to get mixed up about.<\/p>\n<p>If everyone formats their code the same way, uses comments, the same style of documentation and so on, working together becomes that much easier, and the learning curve of joining a new project won\u2019t be as steep.<\/p>\n<p>The need for cohesion in WordPress is magnified by the state in which the codebase is. WordPress does not follow a strict object-oriented approach and doesn\u2019t use an MVC pattern. Projects that follow an OOP and MVC guidelines without exception (like <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/laravel.com\/\">Laravel<\/a>) have consistency and best practices \u201cbaked in\u201d due to their structure.<\/p>\n<p>WordPress is unfortunately ripe for spaghetti coding, aka <strong>doing whatever you want<\/strong>. Best practices are difficult to enforce simply because products employing bad code may work just as well (on the surface).<\/p>\n<p>By following the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/codex.wordpress.org\/WordPress_Coding_Standards\">WordPress Coding Standards<\/a> you can learn a little about the coding ethos of WordPress, create more WordPress-compatible products, show the community that you care and wrangle high-quality code.<\/p>\n<p><strong>More on Hongkiat.com:<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/www.hongkiat.com\/blog\/coders-worst-nightmare\/\">10 Worst Nightmares for Web Developers<\/a><\/li>\n<li><a href=\"https:\/\/www.hongkiat.com\/blog\/css-is-the-hardest-language\/\">5 Reasons Why CSS Could Be the Hardest Language of All<\/a><\/li>\n<li><a href=\"https:\/\/www.hongkiat.com\/blog\/things-programmers-say\/\">30 Common Reactions Programmers Have When Things Go Wrong<\/a><\/li>\n<\/ul>\n<h3>Some Notes on the Standards<\/h3>\n<p><strong>The standards do not define right and wrong.<\/strong> You may disagree with a rule, for example <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/make.wordpress.org\/core\/2013\/11\/13\/proposed-coding-standards-change-always-require-braces\/\">braces should always be used<\/a>, even if they are not needed. The purpose of the WordPress coding standards is not to decide if you are right or wrong, it\u2019s to decide how it should be done in WordPress.<\/p>\n<p><strong>The standards are not up for debate.<\/strong> Use of the standards is not the place to take a stand against an indentation style you don\u2019t like. If something is in the coding standards then do it that way. WordPress developers will love you for it! That said, if you do not agree with something in there do raise your voice and let people know. It\u2019s always possible to do things better but you should only change your coding style if the standards allow for it.<\/p>\n<p><strong>Consistency over anal retentiveness<\/strong>. If you\u2019re in the last 10% of your project and you\u2019ve just discovered that you\u2019ve been using the incorrect naming convention for classes, don\u2019t switch midway. In my personal opinion, I would rather read something consistently incorrect than something which is sometimes correct and sometimes not. You can always write a script to change things in one go, or read through your code at the end.<\/p>\n<p><strong>Following standards is difficult<\/strong>! Placing a brace on the same line as the function instead of a line below is pretty easy, even if you\u2019re used to hitting enter before. However, when you need to think about 100 little rules, the whole process becomes a bit error-prone. Despite my tough stance on following standards, I am as guilty as anyone else in making mistakes. At the end of the day, incorrect indentation is not an irrevocable sin. Try your best to follow all the rules; you\u2019ll learn everything in time.<\/p>\n<h2>WordPress Coding Standards<\/h2>\n<p>Right now WordPress has <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/codex.wordpress.org\/WordPress_Coding_Standards\">four guides<\/a>, one for each major language used: PHP, HTML, JavaScript, and CSS. They form a part of a larger body of knowledge, the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/make.wordpress.org\/core\/handbook\/\">Core Contributor Handbook<\/a>. Going through everything would take a while so I\u2019ve highlighted some snippets from the four languages which I frequently see people getting wrong.<\/p>\n<h3>PHP<\/h3>\n<p>PHP is the main language of WordPress and is quite a loosely typed language which makes it ripe for regulation.<\/p>\n<h3>Brace Styles<\/h3>\n<p>Starting braces should always be placed at the end of lines. Related statements should be placed on the same line as the previous closing brace. This is best demonstrated with a code example:<\/p>\n<pre>\r\n&lt;?php\r\nif (condition) {\r\n    \/\/ Do Something\r\n} elseif (condition) {\r\n    \/\/ Do Something\r\n} else {\r\n    \/\/ Do Something\r\n}\r\n?&gt;\r\n<\/pre>\n<h3>Generous Space Usage<\/h3>\n<p>I\u2019m not a fan of squashed up code (I have bad eyesight) so this is one I particularly like to enforce. Put spaces after <strong>commas<\/strong>, and on both sides of <strong>logical<\/strong>, <strong>comparison<\/strong>, <strong>string<\/strong>, and <strong>assignment operators<\/strong>, after <strong>if<\/strong>, <strong>elseif<\/strong>, <strong>for<\/strong>, <strong>foreach<\/strong>, and <strong>switch<\/strong> statements and so on.<\/p>\n<p>It\u2019s easier to say where spaces shouldn\u2019t be added! The only times you shouldn\u2019t add spaces are when <strong>typecasting<\/strong> or<strong> referencing arrays<\/strong>.<\/p>\n<p>A rather confusing exception to the exception is arrays where the <strong>array key is a variable<\/strong>, in this case, use a space. This example should make this clear:<\/p>\n<pre>\r\n&lt;?php\r\nfunction my_function( $complete_array = null, $key_1 = 4, $key_2 = 'bar' ) {\r\n    if ( null == $complete_array ) {\r\n        $final_array = $complete_array;\r\n    } else {\r\n        $key_1 = (integer) $key_1;\r\n        $final_array[0] = 'this';\r\n        $final_array[ $key_1 ] = 'is';\r\n        $final_array[ $key_2 ] = 'an';\r\n        $final_array['last'] = 'example';\r\n    }\r\n    return $final_array;\r\n}\r\n?&gt;\r\n<\/pre>\n<h3>Naming Conventions<\/h3>\n<p>This one can be hard to get used to, especially if you come from different environments. In a nutshell:<\/p>\n<ul>\n<li><strong>Variable names<\/strong> should be <strong>all lowercase<\/strong>, words separated with underscores<\/li>\n<li><strong>Class names<\/strong> should use <strong>capitalized words<\/strong> separated by underscores. <strong>Acronyms<\/strong> should be all <strong>uppercase<\/strong><\/li>\n<li><strong>Constants<\/strong> should be <strong>all uppercase<\/strong>, separated by underscores<\/li>\n<li><strong>File names<\/strong> should be <strong>all lowercase<\/strong>, separated with dashes<\/li>\n<\/ul>\n<h3>Yoda Conditions<\/h3>\n<p>Writing conditions the other way around than you\u2019re used to will prevent parsing errors. It looks a bit weird but it is better code.<\/p>\n<pre>\r\n&lt;?php\r\nif ('Daniel' === $name) {\r\n    echo 'Write article you will';\r\n}\r\n?&gt;\r\n<\/pre>\n<h3>HTML<\/h3>\n<p>HTML doesn\u2019t have that many rules associated with it; I could come up with quite a lot to make things more modular. There are only five rules you need to know when writing HTML:<\/p>\n<ol>\n<li>Your code must validate against the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/validator.w3.org\/\">W3C validator<\/a>.<\/li>\n<li>Self-closing HTML tags must have exactly one space before the forward slash (this is one I personally hate, but it\u2019s a W3C specification, not just a WordPress pet peeve).<\/li>\n<li>Attributes and tags must be all lowercase. The only exception is when attribute values are meant for human consumption, in which case they should be typed naturally.<\/li>\n<li>All attributes must have a value and must be quoted (writing <code>&lt;input disabled&gt;<\/code> is not correct).<\/li>\n<li>Indentation should be achieved using tabs and should follow logical structure.<\/li>\n<\/ol>\n<h3>CSS<\/h3>\n<p>CSS is another loosely typed language, so there is plenty of work to be done here as well. Even so, the standards go pretty easy on coders.<\/p>\n<h3>Selectors<\/h3>\n<p>Selectors should be as qualified as necessary, be humanly readable, be all lowercase with words separated with dashes, and attribute selectors should use double quotes. Here\u2019s a concise example:<\/p>\n<pre>\r\n&lt;style&gt;\r\ninput[type=\"text\"],\r\ninput[type=\"password\"],\r\n.name-field {\r\n    background: #f1f1f1;\r\n}\r\n&lt;\/style&gt;\r\n<\/pre>\n<h3>Property Order<\/h3>\n<p>The standards recognize the need for some personal space here as they don\u2019t prescribe a specific order for CSS rules. What they <strong>do<\/strong> say is that you should follow a semantic structure that <strong>makes sense<\/strong>. Group properties by their relationships or group them alphabetically, <strong>just don\u2019t write them out randomly<\/strong>.<\/p>\n<p>The largest cause for randomness is the \u201coh I also need to add a margin\u201d and then proceeding to add it to the bottom. Take the extra .3 seconds and add the rule in the logical place.<\/p>\n<ul>\n<li>Display<\/li>\n<li>Positioning<\/li>\n<li>Box model<\/li>\n<li>Colors and Typography<\/li>\n<li>Other<\/li>\n<\/ul>\n<pre>\r\n.profile-modal {\r\n    display: block;\r\n    position: absolute;\r\n    left: 100px;\r\n    top: 90px;\r\n    background: #ff9900;\r\n    color: #fff;\r\n}\r\n<\/pre>\n<h3>Value Formatting<\/h3>\n<p>This is one place where I particularly hate seeing inconsistencies. If you don\u2019t follow the guidelines, that\u2019s still better than sometimes seeing a space before the value; sometimes using shorthand, sometimes not; sometimes using units on 0 values, sometimes not, etc.<\/p>\n<p>Value formatting is pretty complex but <strong>it does come naturally with some practice<\/strong>. Take a look at the exact guide in the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/make.wordpress.org\/core\/handbook\/coding-standards\/css\/#values\">Codex<\/a> for formatting your values.<\/p>\n<h3>Javascript<\/h3>\n<p>In my experience, Javascript is most prone to going all over the place. While many developers know a considerable amount of Javascript it was learned gradually, as an afterthought to HTML, CSS, and PHP. When you\u2019re just starting out with a new language you make a lot more mistakes and if those mistakes don\u2019t cause fatal errors, they can become ingrained in you.<\/p>\n<p>In many cases, the standards refer to a line limit or state \u201cif a line isn\u2019t too long\u201d. This refers to the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/contribute.jquery.org\/style-guide\/js\/\">jQuery Style Guide<\/a> which imposes a <strong>100-character limit on lines<\/strong>. The WordPress guide is based on the jQuery guide, so it\u2019s a good idea to give that a read as well.<\/p>\n<h3>Semicolons<\/h3>\n<p>This is the simplest rule but is one which is frequently overlooked. Never, ever, omit a semicolon just because your code will work without it. It\u2019s just sloppy.<\/p>\n<h3>Indenting<\/h3>\n<p>Tabs should always be used for indenting. You should also indent the contents of a closure even if the contents of a whole file is contained in one. I\u2019m not sure why but unindented top-level closure bugged me even before I read the standards.<\/p>\n<h3>Breaking lines<\/h3>\n<p>When breaking long strings, always break the line after an operator, <strong>don\u2019t leave a variable hanging about<\/strong>. This makes it obvious at first glance that the line is broken and you haven\u2019t just forgotten a semicolon.<\/p>\n<p>Also, if a condition is long, break it into multiple lines and add an extra tab before it. This one looks very weird to my eyes but the separation it adds between the condition and the body is very visible.<\/p>\n<pre>\r\n&lt;script&gt;\r\nif (firstCondition() && secondCondition() &&\r\n    thirdCondition()) {\r\n    var html = 'This line consists of ' + n + ' words, so it should be broken down after ' +\r\n        'an operator';\r\n}\r\n&lt;\/script&gt;\r\n<\/pre>\n<h3>jQuery Iteration<\/h3>\n<p>According to the standards, jQuery iteration <code>(jQuery.each())<\/code> should only be used on jQuery objects. You should use basic <strong>for<\/strong>, <strong>for\/in<\/strong>, <strong>while<\/strong> loops in Javascript for iterating over other collections.<\/p>\n<h2>Conclusion<\/h2>\n<p>There is a lot to note and keep track of, and there is no way someone can apply all this in one go. You should take your code as close as you can to the standards and work at following them exactly.<\/p>\n<p>In my opinion, <strong>consistency is the most important rule<\/strong>. It is better to consistently do something incorrectly than to switch halfway. This is especially true with formatting practices since these don\u2019t affect the functionality of your code and \u2013 for the most part \u2013 <strong>can be easily batch-changed later<\/strong>.<\/p>\n<p>Do you hate an element of the coding standards, do you think something should be added? Let us know in the comments!<\/p>","protected":false},"excerpt":{"rendered":"<p>The reason that we have coding standards at all (not just for WordPress) is to create a familiar environment for programmers working on a project. WordPress in particular encompasses a wide variety of products. From the core itself to themes and plugins, there is a lot to look at \u2013 and a lot to get&hellip;<\/p>\n","protected":false},"author":143,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[49],"tags":[4663,252],"topic":[4520],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>WordPress Coding Standards: A Guide for Developers - Hongkiat<\/title>\n<meta name=\"description\" content=\"The reason that we have coding standards at all (not just for WordPress) is to create a familiar environment for programmers working on a project.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/wordpress-coding-standard\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WordPress Coding Standards: A Guide for Developers\" \/>\n<meta property=\"og:description\" content=\"The reason that we have coding standards at all (not just for WordPress) is to create a familiar environment for programmers working on a project.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/wordpress-coding-standard\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2015-02-13T13:01:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-03T18:02:40+00:00\" \/>\n<meta name=\"author\" content=\"Daniel Pataki\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Daniel Pataki\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-coding-standard\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-coding-standard\\\/\"},\"author\":{\"name\":\"Daniel Pataki\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/76d3b3baacd688e9a0d7bd24553519bc\"},\"headline\":\"WordPress Coding Standards: A Guide for Developers\",\"datePublished\":\"2015-02-13T13:01:16+00:00\",\"dateModified\":\"2025-04-03T18:02:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-coding-standard\\\/\"},\"wordCount\":1608,\"commentCount\":17,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"keywords\":[\"ad-divi\",\"WordPress Tips\"],\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-coding-standard\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-coding-standard\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-coding-standard\\\/\",\"name\":\"WordPress Coding Standards: A Guide for Developers - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"datePublished\":\"2015-02-13T13:01:16+00:00\",\"dateModified\":\"2025-04-03T18:02:40+00:00\",\"description\":\"The reason that we have coding standards at all (not just for WordPress) is to create a familiar environment for programmers working on a project.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-coding-standard\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-coding-standard\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-coding-standard\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress Coding Standards: A Guide for Developers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/76d3b3baacd688e9a0d7bd24553519bc\",\"name\":\"Daniel Pataki\",\"description\":\"Daniel is a writer for Hongkiat.com. When not coding or writing, you'll find him playing board games or running with his dog. You can drop him a line on Twitter or visit his personal website.\",\"sameAs\":[\"http:\\\/\\\/danielpataki.com\\\/\"],\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/danielpataki\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"WordPress Coding Standards: A Guide for Developers - Hongkiat","description":"The reason that we have coding standards at all (not just for WordPress) is to create a familiar environment for programmers working on a project.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hongkiat.com\/blog\/wordpress-coding-standard\/","og_locale":"en_US","og_type":"article","og_title":"WordPress Coding Standards: A Guide for Developers","og_description":"The reason that we have coding standards at all (not just for WordPress) is to create a familiar environment for programmers working on a project.","og_url":"https:\/\/www.hongkiat.com\/blog\/wordpress-coding-standard\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2015-02-13T13:01:16+00:00","article_modified_time":"2025-04-03T18:02:40+00:00","author":"Daniel Pataki","twitter_card":"summary_large_image","twitter_creator":"@hongkiat","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Daniel Pataki","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-coding-standard\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-coding-standard\/"},"author":{"name":"Daniel Pataki","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/76d3b3baacd688e9a0d7bd24553519bc"},"headline":"WordPress Coding Standards: A Guide for Developers","datePublished":"2015-02-13T13:01:16+00:00","dateModified":"2025-04-03T18:02:40+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-coding-standard\/"},"wordCount":1608,"commentCount":17,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"keywords":["ad-divi","WordPress Tips"],"articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/wordpress-coding-standard\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-coding-standard\/","url":"https:\/\/www.hongkiat.com\/blog\/wordpress-coding-standard\/","name":"WordPress Coding Standards: A Guide for Developers - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"datePublished":"2015-02-13T13:01:16+00:00","dateModified":"2025-04-03T18:02:40+00:00","description":"The reason that we have coding standards at all (not just for WordPress) is to create a familiar environment for programmers working on a project.","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-coding-standard\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/wordpress-coding-standard\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-coding-standard\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"WordPress Coding Standards: A Guide for Developers"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/76d3b3baacd688e9a0d7bd24553519bc","name":"Daniel Pataki","description":"Daniel is a writer for Hongkiat.com. When not coding or writing, you'll find him playing board games or running with his dog. You can drop him a line on Twitter or visit his personal website.","sameAs":["http:\/\/danielpataki.com\/"],"url":"https:\/\/www.hongkiat.com\/blog\/author\/danielpataki\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-63G","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/23292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/143"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=23292"}],"version-history":[{"count":3,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/23292\/revisions"}],"predecessor-version":[{"id":73729,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/23292\/revisions\/73729"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=23292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=23292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=23292"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=23292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}