<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhammad Medhat</title>
    <description>The latest articles on DEV Community by Muhammad Medhat (@muhammadmedhat).</description>
    <link>https://dev.to/muhammadmedhat</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F902861%2F6b74e488-ba5e-4a22-bff1-907795830f32.jpeg</url>
      <title>DEV Community: Muhammad Medhat</title>
      <link>https://dev.to/muhammadmedhat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muhammadmedhat"/>
    <language>en</language>
    <item>
      <title>WordPress Block Themes vs Classic Themes: Should You Switch in 2026?</title>
      <dc:creator>Muhammad Medhat</dc:creator>
      <pubDate>Sun, 16 Aug 2026 15:17:39 +0000</pubDate>
      <link>https://dev.to/muhammadmedhat/wordpress-block-themes-vs-classic-themes-should-you-switch-in-2026-2e1d</link>
      <guid>https://dev.to/muhammadmedhat/wordpress-block-themes-vs-classic-themes-should-you-switch-in-2026-2e1d</guid>
      <description>&lt;p&gt;If you've been developing WordPress websites for several years, there's a good chance you've spent a lot of time working with files like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;header.php
footer.php
single.php
page.php
archive.php
functions.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's certainly where most of my WordPress development experience has been.&lt;/p&gt;

&lt;p&gt;But WordPress has been changing.&lt;/p&gt;

&lt;p&gt;With the Block Editor, Site Editor, block themes, patterns, and &lt;code&gt;theme.json&lt;/code&gt;, WordPress now offers a very different approach to theme development.&lt;/p&gt;

&lt;p&gt;So I decided to take a closer look at the question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;If you're already comfortable building classic WordPress themes, is it worth moving toward block themes in 2026?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This isn't an article written from the perspective of someone who has spent years exclusively building block themes. Most of my own WordPress work has traditionally involved &lt;strong&gt;classic themes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead, I'm looking at block themes from the perspective of an experienced WordPress developer who is exploring how the platform is evolving—and where the newer approach fits alongside the architecture I've used extensively.&lt;/p&gt;




&lt;h2&gt;
  
  
  Classic Themes vs Block Themes
&lt;/h2&gt;

&lt;p&gt;WordPress currently identifies two primary theme types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Classic themes&lt;/li&gt;
&lt;li&gt;Block themes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;According to the official WordPress Theme Developer Handbook, classic themes primarily use PHP, JavaScript, and CSS and can make extensive use of WordPress functions, hooks, and filters.&lt;/p&gt;

&lt;p&gt;Block themes, on the other hand, are built around block markup and HTML-based templates and allow users to edit more areas of the website through the Site Editor.&lt;/p&gt;

&lt;p&gt;A simplified comparison looks like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Classic Theme&lt;/th&gt;
&lt;th&gt;Block Theme&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;PHP templates&lt;/td&gt;
&lt;td&gt;HTML block templates&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;single.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;templates/single.html&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;parts/header.html&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;footer.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;parts/footer.html&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Template hierarchy&lt;/td&gt;
&lt;td&gt;Block-based templates&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Custom PHP logic&lt;/td&gt;
&lt;td&gt;Blocks + APIs + plugins&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Customizer / theme options&lt;/td&gt;
&lt;td&gt;Site Editor / Styles&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;theme.json&lt;/code&gt; optional&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;theme.json&lt;/code&gt; commonly used&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This doesn't mean classic themes are obsolete.&lt;/p&gt;

&lt;p&gt;They aren't.&lt;/p&gt;

&lt;p&gt;WordPress continues to maintain documentation for classic theme development, and classic themes remain a valid part of the platform.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I'm Used to: Classic Themes
&lt;/h2&gt;

&lt;p&gt;A traditional WordPress theme might have a structure like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-theme/
├── style.css
├── functions.php
├── index.php
├── header.php
├── footer.php
├── sidebar.php
├── single.php
├── page.php
├── archive.php
└── 404.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The templates contain PHP and WordPress template functions.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nf"&gt;get_header&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;main&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"site-content"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nf"&gt;have_posts&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;

        &lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nf"&gt;have_posts&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;the_post&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;

            &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nf"&gt;post_class&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

                &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nf"&gt;the_title&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;

                &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"entry-content"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nf"&gt;the_content&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

            &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;

        &lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="k"&gt;endwhile&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;

    &lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="k"&gt;endif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/main&amp;gt;&lt;/span&gt;

&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nf"&gt;get_footer&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For developers who have spent years working with WordPress, this architecture is very familiar.&lt;/p&gt;

&lt;p&gt;You have direct access to PHP, the Loop, template files, hooks, filters, conditional tags, queries, and all the other tools that make WordPress flexible.&lt;/p&gt;

&lt;p&gt;The official WordPress documentation still describes this as the classic theme approach.&lt;/p&gt;




&lt;h2&gt;
  
  
  So What Is a Block Theme?
&lt;/h2&gt;

&lt;p&gt;A block theme changes the way the theme's templates are constructed.&lt;/p&gt;

&lt;p&gt;Instead of building your main templates using PHP, you use HTML files containing WordPress block markup.&lt;/p&gt;

&lt;p&gt;A simplified block theme might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-block-theme/
├── style.css
├── theme.json
├── templates/
│   ├── index.html
│   ├── single.html
│   └── page.html
└── parts/
    ├── header.html
    └── footer.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;code&gt;single.html&lt;/code&gt; template could look something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- wp:template-part {"slug":"header"} /--&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- wp:group {"tagName":"main"} --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;main&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"wp-block-group"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- wp:post-title /--&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- wp:post-featured-image /--&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- wp:post-content /--&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/main&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- /wp:group --&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- wp:template-part {"slug":"footer"} /--&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There's no traditional PHP Loop here.&lt;/p&gt;

&lt;p&gt;Instead, the template is composed of blocks.&lt;/p&gt;

&lt;p&gt;WordPress defines a block theme as a theme that has an &lt;code&gt;index.html&lt;/code&gt; template in the &lt;code&gt;templates&lt;/code&gt; or &lt;code&gt;block-templates&lt;/code&gt; directory, with templates built from block markup.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Big Difference: Who Controls the Layout?
&lt;/h2&gt;

&lt;p&gt;This is probably the most important conceptual difference.&lt;/p&gt;

&lt;p&gt;With a traditional classic theme, the developer typically controls the site's structure through PHP template files.&lt;/p&gt;

&lt;p&gt;With a block theme, the Site Editor can be used to edit areas such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Header&lt;/li&gt;
&lt;li&gt;Footer&lt;/li&gt;
&lt;li&gt;Navigation&lt;/li&gt;
&lt;li&gt;Templates&lt;/li&gt;
&lt;li&gt;Template parts&lt;/li&gt;
&lt;li&gt;Global styles&lt;/li&gt;
&lt;li&gt;Other block-based content&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This means the site owner can have significantly more control over the structure of the website without modifying PHP files.&lt;/p&gt;

&lt;p&gt;WordPress describes this as one of the major advantages of block themes.&lt;/p&gt;

&lt;p&gt;For a client who frequently wants to modify the website layout, this can be a big advantage.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where Does &lt;code&gt;theme.json&lt;/code&gt; Fit?
&lt;/h2&gt;

&lt;p&gt;This is one of the areas I find particularly interesting.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;theme.json&lt;/code&gt; is a configuration file that allows developers to define global settings and styles for a WordPress theme.&lt;/p&gt;

&lt;p&gt;And importantly:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;theme.json&lt;/code&gt; isn't exclusive to block themes.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;WordPress's official documentation explicitly states that &lt;code&gt;theme.json&lt;/code&gt; works with &lt;strong&gt;both block and classic themes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That makes it especially interesting for developers who primarily work with classic themes.&lt;/p&gt;

&lt;p&gt;You don't necessarily need to abandon your existing development approach to start using modern WordPress features.&lt;/p&gt;




&lt;h2&gt;
  
  
  A Simple &lt;code&gt;theme.json&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;A basic modern &lt;code&gt;theme.json&lt;/code&gt; could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://schemas.wp.org/wp/6.6/theme.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"settings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"appearanceTools"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"layout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"contentSize"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"720px"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"wideSize"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1200px"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are two properties here that developers should understand:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="s2"&gt;"$schema"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They aren't the same thing.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;version&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;version&lt;/code&gt; property specifies which &lt;code&gt;theme.json&lt;/code&gt; schema version the theme is using.&lt;/p&gt;

&lt;p&gt;As of the current official documentation, &lt;strong&gt;Version 3 is the latest &lt;code&gt;theme.json&lt;/code&gt; version&lt;/strong&gt;. Version 3 works with WordPress 6.6 and later.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;$schema&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;$schema&lt;/code&gt; property tells development tools which JSON Schema to use.&lt;/p&gt;

&lt;p&gt;This can provide features such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Autocomplete&lt;/li&gt;
&lt;li&gt;Validation&lt;/li&gt;
&lt;li&gt;Editor hints&lt;/li&gt;
&lt;li&gt;Error reporting&lt;/li&gt;
&lt;li&gt;Property suggestions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;WordPress provides schemas for individual WordPress versions, and its documentation recommends using the oldest WordPress version your theme supports when choosing a version-specific schema.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://schemas.wp.org/wp/6.6/theme.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your theme targets a different minimum WordPress version, use the appropriate schema URL for that target.&lt;/p&gt;

&lt;p&gt;For the latest development schema, WordPress also provides:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://schemas.wp.org/trunk/theme.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, for a production theme, targeting the appropriate stable WordPress version is generally safer than relying on &lt;code&gt;trunk&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Is &lt;code&gt;theme.json&lt;/code&gt; Important?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;theme.json&lt;/code&gt; can control a surprisingly large part of the WordPress design system.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://schemas.wp.org/wp/6.6/theme.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="nl"&gt;"settings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"color"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"palette"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"slug"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"primary"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"color"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"#2563eb"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Primary"&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"slug"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"dark"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"color"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"#111827"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Dark"&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;

        &lt;/span&gt;&lt;span class="nl"&gt;"typography"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"fluid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can use &lt;code&gt;theme.json&lt;/code&gt; for things such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Color palettes&lt;/li&gt;
&lt;li&gt;Typography&lt;/li&gt;
&lt;li&gt;Spacing&lt;/li&gt;
&lt;li&gt;Layout&lt;/li&gt;
&lt;li&gt;Borders&lt;/li&gt;
&lt;li&gt;Shadows&lt;/li&gt;
&lt;li&gt;Block settings&lt;/li&gt;
&lt;li&gt;Custom templates&lt;/li&gt;
&lt;li&gt;Template parts&lt;/li&gt;
&lt;li&gt;Patterns&lt;/li&gt;
&lt;li&gt;Global styles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The official documentation describes &lt;code&gt;theme.json&lt;/code&gt; as a configuration file for global settings, styles, templates, template parts, and more.&lt;/p&gt;




&lt;h2&gt;
  
  
  Classic Themes Can Use Modern WordPress Features Too
&lt;/h2&gt;

&lt;p&gt;This is an important point that sometimes gets lost in the block-theme discussion.&lt;/p&gt;

&lt;p&gt;You don't necessarily have:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Classic theme &lt;strong&gt;OR&lt;/strong&gt; modern WordPress.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There is a middle ground.&lt;/p&gt;

&lt;p&gt;WordPress documentation specifically notes that classic themes can use &lt;code&gt;theme.json&lt;/code&gt; and take advantage of block-editor functionality.&lt;/p&gt;

&lt;p&gt;The WordPress community sometimes calls these &lt;strong&gt;hybrid themes&lt;/strong&gt;—classic themes that adopt some modern block-related functionality.&lt;/p&gt;

&lt;p&gt;WordPress notes that "hybrid theme" is a commonly used community term rather than an official third theme type.&lt;/p&gt;

&lt;p&gt;This is actually an interesting option for developers like me who have extensive experience with classic themes.&lt;/p&gt;

&lt;p&gt;You can gradually adopt newer WordPress capabilities without necessarily rewriting an entire project.&lt;/p&gt;




&lt;h2&gt;
  
  
  Template Parts: PHP vs Blocks
&lt;/h2&gt;

&lt;p&gt;Here's another example of the architectural difference.&lt;/p&gt;

&lt;p&gt;In a classic theme, you might have:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nf"&gt;get_header&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;

...

&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nf"&gt;get_footer&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;WordPress also provides functions such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;get_template_part&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for reusing template components.&lt;/p&gt;

&lt;p&gt;With a block theme, you can use template-part blocks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- wp:template-part {"slug":"header"} /--&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- wp:post-content /--&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- wp:template-part {"slug":"footer"} /--&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The underlying concept is similar:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Reuse common parts of your website.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But the implementation is different.&lt;/p&gt;

&lt;p&gt;The classic approach uses PHP templates and WordPress functions.&lt;/p&gt;

&lt;p&gt;The block approach uses block markup and template parts.&lt;/p&gt;




&lt;h2&gt;
  
  
  Does a Block Theme Mean No PHP?
&lt;/h2&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;This is another misconception worth clearing up.&lt;/p&gt;

&lt;p&gt;WordPress is still a PHP application.&lt;/p&gt;

&lt;p&gt;Plugins can still register:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Custom post types&lt;/li&gt;
&lt;li&gt;Taxonomies&lt;/li&gt;
&lt;li&gt;REST API endpoints&lt;/li&gt;
&lt;li&gt;Hooks&lt;/li&gt;
&lt;li&gt;Filters&lt;/li&gt;
&lt;li&gt;Custom functionality&lt;/li&gt;
&lt;li&gt;Server-side logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'init'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="nf"&gt;register_post_type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'portfolio'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'public'&lt;/span&gt;   &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'label'&lt;/span&gt;    &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Portfolio'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'supports'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'title'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'editor'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'thumbnail'&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The difference is primarily in &lt;strong&gt;how the theme handles presentation and templates&lt;/strong&gt;, not that PHP suddenly disappears from WordPress.&lt;/p&gt;

&lt;p&gt;In fact, keeping application/business functionality in plugins rather than tying it tightly to the theme is often a useful architectural approach.&lt;/p&gt;




&lt;h2&gt;
  
  
  When Would I Still Choose a Classic Theme?
&lt;/h2&gt;

&lt;p&gt;This is where my own experience influences my answer.&lt;/p&gt;

&lt;p&gt;If I were working on an existing project that is already built around a classic theme and works well, I wouldn't automatically recommend rebuilding it as a block theme.&lt;/p&gt;

&lt;p&gt;There has to be a reason.&lt;/p&gt;

&lt;p&gt;For example, I'd be comfortable continuing with a classic theme when:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The existing architecture works
&lt;/h3&gt;

&lt;p&gt;If the site is stable, maintainable, and meeting the client's requirements, changing architecture just because a newer approach exists doesn't necessarily provide enough value.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The project relies heavily on custom PHP templates
&lt;/h3&gt;

&lt;p&gt;Some projects have complex template logic and custom integrations where the traditional PHP architecture is already a good fit.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. The team knows the classic architecture well
&lt;/h3&gt;

&lt;p&gt;Development speed and maintainability matter.&lt;/p&gt;

&lt;p&gt;If a team can build and maintain a classic theme efficiently, that has real value.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. The client doesn't need full Site Editor control
&lt;/h3&gt;

&lt;p&gt;If the website structure is intentionally controlled by developers, the biggest advantage of a block theme may not be necessary.&lt;/p&gt;




&lt;h2&gt;
  
  
  When Would I Consider a Block Theme?
&lt;/h2&gt;

&lt;p&gt;For a new project, however, I would definitely consider a block theme.&lt;/p&gt;

&lt;p&gt;Especially when:&lt;/p&gt;

&lt;h3&gt;
  
  
  The client wants visual control
&lt;/h3&gt;

&lt;p&gt;If the client wants to modify headers, footers, templates, and global styles without involving a developer, the Site Editor can be very useful.&lt;/p&gt;

&lt;h3&gt;
  
  
  The website is heavily block-based
&lt;/h3&gt;

&lt;p&gt;If the entire content strategy already revolves around Gutenberg, patterns, and blocks, a block theme can be a natural fit.&lt;/p&gt;

&lt;h3&gt;
  
  
  You want a centralized design system
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;theme.json&lt;/code&gt; provides a structured way to define colors, typography, spacing, layout, and other design settings.&lt;/p&gt;

&lt;h3&gt;
  
  
  You're building a new theme from scratch
&lt;/h3&gt;

&lt;p&gt;A new project gives you an opportunity to adopt the architecture without having to migrate years of existing code.&lt;/p&gt;

&lt;p&gt;WordPress's current Theme Handbook describes block themes as the modern method of building WordPress themes and says its theme-development documentation primarily focuses on this approach.&lt;/p&gt;




&lt;h2&gt;
  
  
  What About Performance?
&lt;/h2&gt;

&lt;p&gt;This is one area where I would avoid making absolute claims.&lt;/p&gt;

&lt;p&gt;You'll sometimes hear:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Block themes are faster."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Or:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Classic themes are faster."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Neither statement is universally true.&lt;/p&gt;

&lt;p&gt;Performance depends on the implementation.&lt;/p&gt;

&lt;p&gt;A poorly optimized block theme can be slow.&lt;/p&gt;

&lt;p&gt;A carefully built classic theme can be extremely fast.&lt;/p&gt;

&lt;p&gt;Things such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hosting&lt;/li&gt;
&lt;li&gt;Database queries&lt;/li&gt;
&lt;li&gt;Images&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;CSS&lt;/li&gt;
&lt;li&gt;Third-party scripts&lt;/li&gt;
&lt;li&gt;Plugins&lt;/li&gt;
&lt;li&gt;Caching&lt;/li&gt;
&lt;li&gt;Page complexity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;can all have a major impact.&lt;/p&gt;

&lt;p&gt;So I wouldn't choose a theme architecture based solely on the assumption that one is automatically faster.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Should a Classic-Theme Developer Learn?
&lt;/h2&gt;

&lt;p&gt;This is probably the question I'm asking myself as much as anyone reading this article.&lt;/p&gt;

&lt;p&gt;If you've already spent years learning classic WordPress development, should you throw all of that knowledge away?&lt;/p&gt;

&lt;p&gt;Definitely not.&lt;/p&gt;

&lt;p&gt;I would look at it as an expansion of your existing skills.&lt;/p&gt;

&lt;p&gt;A reasonable learning path could be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Classic WordPress Development
            ↓
       Gutenberg
            ↓
       Block Editor
            ↓
       theme.json
            ↓
       Block Patterns
            ↓
       Block Themes
            ↓
      Custom Blocks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your existing knowledge of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PHP&lt;/li&gt;
&lt;li&gt;WordPress hooks&lt;/li&gt;
&lt;li&gt;Filters&lt;/li&gt;
&lt;li&gt;Template hierarchy&lt;/li&gt;
&lt;li&gt;The Loop&lt;/li&gt;
&lt;li&gt;Custom post types&lt;/li&gt;
&lt;li&gt;REST APIs&lt;/li&gt;
&lt;li&gt;Plugins&lt;/li&gt;
&lt;li&gt;Security&lt;/li&gt;
&lt;li&gt;Performance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;doesn't become useless.&lt;/p&gt;

&lt;p&gt;You're simply adding another layer to your WordPress toolkit.&lt;/p&gt;




&lt;h2&gt;
  
  
  My Perspective as a WordPress Developer
&lt;/h2&gt;

&lt;p&gt;Most of my WordPress development experience has been with &lt;strong&gt;classic themes&lt;/strong&gt;, so I'm not going to pretend that I've spent the majority of my career building block themes.&lt;/p&gt;

&lt;p&gt;I haven't.&lt;/p&gt;

&lt;p&gt;But that's exactly why I found the evolution interesting.&lt;/p&gt;

&lt;p&gt;When you've been working with WordPress for years, it's easy to keep using the architecture you're comfortable with.&lt;/p&gt;

&lt;p&gt;And there is nothing wrong with that when the architecture is appropriate.&lt;/p&gt;

&lt;p&gt;But WordPress is clearly investing heavily in the block-based direction.&lt;/p&gt;

&lt;p&gt;The official Theme Handbook now describes block themes as the modern method of building themes and focuses its current guidance heavily on that approach.&lt;/p&gt;

&lt;p&gt;For me, that doesn't mean:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Classic themes are dead."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It means:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"As WordPress developers, we should understand where the platform is going, even if our current projects still use the architecture we're most experienced with."&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's the approach I'm taking.&lt;/p&gt;

&lt;p&gt;I'm not replacing my classic-theme knowledge.&lt;/p&gt;

&lt;p&gt;I'm expanding it.&lt;/p&gt;




&lt;h2&gt;
  
  
  So, Should You Switch?
&lt;/h2&gt;

&lt;p&gt;My answer is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It depends.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're maintaining an existing classic WordPress website that works well, I wouldn't migrate it simply because block themes are newer.&lt;/p&gt;

&lt;p&gt;If you're starting a new project, I'd at least evaluate whether a block theme makes sense.&lt;/p&gt;

&lt;p&gt;And if you're a WordPress developer who has mostly worked with classic themes, I'd definitely recommend learning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Block Editor
theme.json
Patterns
Template Parts
Site Editor
Block Themes
Custom Blocks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You don't need to become a block-theme expert overnight.&lt;/p&gt;

&lt;p&gt;But understanding the architecture will make it much easier to work with modern WordPress projects.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;WordPress theme development isn't necessarily a choice between:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Classic = Old
Block = New
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's more nuanced than that.&lt;/p&gt;

&lt;p&gt;Classic themes remain powerful and relevant.&lt;/p&gt;

&lt;p&gt;Block themes provide a newer approach that gives WordPress users much greater control over templates and site-wide design through blocks and the Site Editor.&lt;/p&gt;

&lt;p&gt;And &lt;code&gt;theme.json&lt;/code&gt; provides an interesting bridge between the two worlds because it can be used with both classic and block themes.&lt;/p&gt;

&lt;p&gt;For developers who have spent years working with classic themes, the goal shouldn't be to forget everything we already know.&lt;/p&gt;

&lt;p&gt;The goal is to understand the new architecture well enough to decide &lt;strong&gt;when it actually makes sense to use it&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That's where I currently see the value in learning block themes.&lt;/p&gt;

&lt;p&gt;Not because classic themes have suddenly become irrelevant—but because WordPress itself is evolving, and we should evolve with it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Official WordPress References
&lt;/h2&gt;

&lt;p&gt;This article is based primarily on the official WordPress Developer Documentation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;WordPress Theme Developer Handbook&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://developer.wordpress.org/themes/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/themes/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;What Is a Theme?&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://developer.wordpress.org/themes/getting-started/what-is-a-theme/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/themes/getting-started/what-is-a-theme/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Block Editor — Themes&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://developer.wordpress.org/block-editor/how-to-guides/themes/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/block-editor/how-to-guides/themes/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Introduction to &lt;code&gt;theme.json&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://developer.wordpress.org/themes/global-settings-and-styles/introduction-to-theme-json/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/themes/global-settings-and-styles/introduction-to-theme-json/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;theme.json&lt;/code&gt; Version 3 Reference&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-living/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-living/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Developing with &lt;code&gt;theme.json&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://developer.wordpress.org/block-editor/how-to-guides/themes/global-settings-and-styles/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/block-editor/how-to-guides/themes/global-settings-and-styles/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Classic Themes&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://developer.wordpress.org/themes/classic-themes/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/themes/classic-themes/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All technical claims and examples in this article should be checked against the official documentation for the WordPress version your project supports, particularly when working with &lt;code&gt;theme.json&lt;/code&gt; versions and schemas.&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>php</category>
      <category>webdev</category>
      <category>wordpress</category>
    </item>
    <item>
      <title>WordPress Block Themes vs Classic Themes: Should You Switch in 2026?</title>
      <dc:creator>Muhammad Medhat</dc:creator>
      <pubDate>Sun, 16 Aug 2026 15:10:57 +0000</pubDate>
      <link>https://dev.to/muhammadmedhat/wordpress-block-themes-vs-classic-themes-should-you-switch-in-2026-2dp6</link>
      <guid>https://dev.to/muhammadmedhat/wordpress-block-themes-vs-classic-themes-should-you-switch-in-2026-2dp6</guid>
      <description>&lt;p&gt;If you've been developing WordPress websites for several years, there's a good chance you've spent a lot of time working with files like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;header.php
footer.php
single.php
page.php
archive.php
functions.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's certainly where most of my WordPress development experience has been.&lt;/p&gt;

&lt;p&gt;But WordPress has been changing.&lt;/p&gt;

&lt;p&gt;With the Block Editor, Site Editor, block themes, patterns, and &lt;code&gt;theme.json&lt;/code&gt;, WordPress now offers a very different approach to theme development.&lt;/p&gt;

&lt;p&gt;So I decided to take a closer look at the question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;If you're already comfortable building classic WordPress themes, is it worth moving toward block themes in 2026?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This isn't an article written from the perspective of someone who has spent years exclusively building block themes. Most of my own WordPress work has traditionally involved &lt;strong&gt;classic themes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead, I'm looking at block themes from the perspective of an experienced WordPress developer who is exploring how the platform is evolving—and where the newer approach fits alongside the architecture I've used extensively.&lt;/p&gt;




&lt;h2&gt;
  
  
  Classic Themes vs Block Themes
&lt;/h2&gt;

&lt;p&gt;WordPress currently identifies two primary theme types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Classic themes&lt;/li&gt;
&lt;li&gt;Block themes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;According to the official WordPress Theme Developer Handbook, classic themes primarily use PHP, JavaScript, and CSS and can make extensive use of WordPress functions, hooks, and filters.&lt;/p&gt;

&lt;p&gt;Block themes, on the other hand, are built around block markup and HTML-based templates and allow users to edit more areas of the website through the Site Editor.&lt;/p&gt;

&lt;p&gt;A simplified comparison looks like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Classic Theme&lt;/th&gt;
&lt;th&gt;Block Theme&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;PHP templates&lt;/td&gt;
&lt;td&gt;HTML block templates&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;single.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;templates/single.html&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Template parts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;footer.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Template parts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Template hierarchy&lt;/td&gt;
&lt;td&gt;Block-based templates&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Custom PHP logic&lt;/td&gt;
&lt;td&gt;Blocks + APIs + plugins&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Customizer / theme options&lt;/td&gt;
&lt;td&gt;Site Editor / Styles&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;theme.json&lt;/code&gt; optional&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;theme.json&lt;/code&gt; commonly used&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This doesn't mean classic themes are obsolete.&lt;/p&gt;

&lt;p&gt;They aren't.&lt;/p&gt;

&lt;p&gt;WordPress continues to maintain documentation for classic theme development, and classic themes remain a valid part of the platform.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I'm Used to: Classic Themes
&lt;/h2&gt;

&lt;p&gt;A traditional WordPress theme might have a structure like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-theme/
├── style.css
├── functions.php
├── index.php
├── header.php
├── footer.php
├── sidebar.php
├── single.php
├── page.php
├── archive.php
└── 404.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The templates contain PHP and WordPress template functions.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nf"&gt;get_header&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;main&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"site-content"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nf"&gt;have_posts&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;

        &lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nf"&gt;have_posts&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;the_post&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;

            &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nf"&gt;post_class&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

                &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nf"&gt;the_title&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;

                &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"entry-content"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nf"&gt;the_content&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

            &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;

        &lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="k"&gt;endwhile&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;

    &lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="k"&gt;endif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/main&amp;gt;&lt;/span&gt;

&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nf"&gt;get_footer&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For developers who have spent years working with WordPress, this architecture is very familiar.&lt;/p&gt;

&lt;p&gt;You have direct access to PHP, the Loop, template files, hooks, filters, conditional tags, queries, and all the other tools that make WordPress flexible.&lt;/p&gt;

&lt;p&gt;The official WordPress documentation still describes this as the classic theme approach.&lt;/p&gt;




&lt;h2&gt;
  
  
  So What Is a Block Theme?
&lt;/h2&gt;

&lt;p&gt;A block theme changes the way the theme's templates are constructed.&lt;/p&gt;

&lt;p&gt;Instead of building your main templates using PHP, you use HTML files containing WordPress block markup.&lt;/p&gt;

&lt;p&gt;A simplified block theme might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-block-theme/
├── style.css
├── theme.json
├── templates/
│   ├── index.html
│   ├── single.html
│   └── page.html
└── parts/
    ├── header.html
    └── footer.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;code&gt;single.html&lt;/code&gt; template could look something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- wp:template-part {"slug":"header"} /--&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- wp:group {"tagName":"main"} --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;main&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"wp-block-group"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- wp:post-title /--&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- wp:post-featured-image /--&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- wp:post-content /--&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/main&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- /wp:group --&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- wp:template-part {"slug":"footer"} /--&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There's no traditional PHP Loop here.&lt;/p&gt;

&lt;p&gt;Instead, the template is composed of blocks.&lt;/p&gt;

&lt;p&gt;WordPress defines a block theme as a theme that has an &lt;code&gt;index.html&lt;/code&gt; template in the &lt;code&gt;templates&lt;/code&gt; or &lt;code&gt;block-templates&lt;/code&gt; directory, with templates built from block markup.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Big Difference: Who Controls the Layout?
&lt;/h2&gt;

&lt;p&gt;This is probably the most important conceptual difference.&lt;/p&gt;

&lt;p&gt;With a traditional classic theme, the developer typically controls the site's structure through PHP template files.&lt;/p&gt;

&lt;p&gt;With a block theme, the Site Editor can be used to edit areas such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Header&lt;/li&gt;
&lt;li&gt;Footer&lt;/li&gt;
&lt;li&gt;Navigation&lt;/li&gt;
&lt;li&gt;Templates&lt;/li&gt;
&lt;li&gt;Template parts&lt;/li&gt;
&lt;li&gt;Global styles&lt;/li&gt;
&lt;li&gt;Other block-based content&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This means the site owner can have significantly more control over the structure of the website without modifying PHP files.&lt;/p&gt;

&lt;p&gt;WordPress describes this as one of the major advantages of block themes.&lt;/p&gt;

&lt;p&gt;For a client who frequently wants to modify the website layout, this can be a big advantage.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where Does &lt;code&gt;theme.json&lt;/code&gt; Fit?
&lt;/h2&gt;

&lt;p&gt;This is one of the areas I find particularly interesting.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;theme.json&lt;/code&gt; is a configuration file that allows developers to define global settings and styles for a WordPress theme.&lt;/p&gt;

&lt;p&gt;And importantly:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;theme.json&lt;/code&gt; isn't exclusive to block themes.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;WordPress's official documentation explicitly states that &lt;code&gt;theme.json&lt;/code&gt; works with &lt;strong&gt;both block and classic themes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That makes it especially interesting for developers who primarily work with classic themes.&lt;/p&gt;

&lt;p&gt;You don't necessarily need to abandon your existing development approach to start using modern WordPress features.&lt;/p&gt;




&lt;h2&gt;
  
  
  A Simple &lt;code&gt;theme.json&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;A basic modern &lt;code&gt;theme.json&lt;/code&gt; could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://schemas.wp.org/wp/6.6/theme.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"settings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"appearanceTools"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"layout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"contentSize"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"720px"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"wideSize"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1200px"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are two properties here that developers should understand:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="s2"&gt;"$schema"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They aren't the same thing.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;version&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;version&lt;/code&gt; property specifies which &lt;code&gt;theme.json&lt;/code&gt; schema version the theme is using.&lt;/p&gt;

&lt;p&gt;As of the current official documentation, &lt;strong&gt;Version 3 is the latest &lt;code&gt;theme.json&lt;/code&gt; version&lt;/strong&gt;. Version 3 works with WordPress 6.6 and later.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;$schema&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;$schema&lt;/code&gt; property tells development tools which JSON Schema to use.&lt;/p&gt;

&lt;p&gt;This can provide features such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Autocomplete&lt;/li&gt;
&lt;li&gt;Validation&lt;/li&gt;
&lt;li&gt;Editor hints&lt;/li&gt;
&lt;li&gt;Error reporting&lt;/li&gt;
&lt;li&gt;Property suggestions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;WordPress provides schemas for individual WordPress versions, and its documentation recommends using the oldest WordPress version your theme supports when choosing a version-specific schema.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://schemas.wp.org/wp/6.6/theme.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your theme targets a different minimum WordPress version, use the appropriate schema URL for that target.&lt;/p&gt;

&lt;p&gt;For the latest development schema, WordPress also provides:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://schemas.wp.org/trunk/theme.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, for a production theme, targeting the appropriate stable WordPress version is generally safer than relying on &lt;code&gt;trunk&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Is &lt;code&gt;theme.json&lt;/code&gt; Important?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;theme.json&lt;/code&gt; can control a surprisingly large part of the WordPress design system.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://schemas.wp.org/wp/6.6/theme.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="nl"&gt;"settings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"color"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"palette"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"slug"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"primary"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"color"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"#2563eb"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Primary"&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"slug"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"dark"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"color"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"#111827"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Dark"&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;

        &lt;/span&gt;&lt;span class="nl"&gt;"typography"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"fluid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can use &lt;code&gt;theme.json&lt;/code&gt; for things such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Color palettes&lt;/li&gt;
&lt;li&gt;Typography&lt;/li&gt;
&lt;li&gt;Spacing&lt;/li&gt;
&lt;li&gt;Layout&lt;/li&gt;
&lt;li&gt;Borders&lt;/li&gt;
&lt;li&gt;Shadows&lt;/li&gt;
&lt;li&gt;Block settings&lt;/li&gt;
&lt;li&gt;Custom templates&lt;/li&gt;
&lt;li&gt;Template parts&lt;/li&gt;
&lt;li&gt;Patterns&lt;/li&gt;
&lt;li&gt;Global styles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The official documentation describes &lt;code&gt;theme.json&lt;/code&gt; as a configuration file for global settings, styles, templates, template parts, and more.&lt;/p&gt;




&lt;h2&gt;
  
  
  Classic Themes Can Use Modern WordPress Features Too
&lt;/h2&gt;

&lt;p&gt;This is an important point that sometimes gets lost in the block-theme discussion.&lt;/p&gt;

&lt;p&gt;You don't necessarily have:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Classic theme &lt;strong&gt;OR&lt;/strong&gt; modern WordPress.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There is a middle ground.&lt;/p&gt;

&lt;p&gt;WordPress documentation specifically notes that classic themes can use &lt;code&gt;theme.json&lt;/code&gt; and take advantage of block-editor functionality.&lt;/p&gt;

&lt;p&gt;The WordPress community sometimes calls these &lt;strong&gt;hybrid themes&lt;/strong&gt;—classic themes that adopt some modern block-related functionality.&lt;/p&gt;

&lt;p&gt;WordPress notes that "hybrid theme" is a commonly used community term rather than an official third theme type.&lt;/p&gt;

&lt;p&gt;This is actually an interesting option for developers like me who have extensive experience with classic themes.&lt;/p&gt;

&lt;p&gt;You can gradually adopt newer WordPress capabilities without necessarily rewriting an entire project.&lt;/p&gt;




&lt;h2&gt;
  
  
  Template Parts: PHP vs Blocks
&lt;/h2&gt;

&lt;p&gt;Here's another example of the architectural difference.&lt;/p&gt;

&lt;p&gt;In a classic theme, you might have:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nf"&gt;get_header&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;

...

&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nf"&gt;get_footer&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;WordPress also provides functions such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;get_template_part&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for reusing template components.&lt;/p&gt;

&lt;p&gt;With a block theme, you can use template-part blocks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- wp:template-part {"slug":"header"} /--&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- wp:post-content /--&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- wp:template-part {"slug":"footer"} /--&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The underlying concept is similar:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Reuse common parts of your website.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But the implementation is different.&lt;/p&gt;

&lt;p&gt;The classic approach uses PHP templates and WordPress functions.&lt;/p&gt;

&lt;p&gt;The block approach uses block markup and template parts.&lt;/p&gt;




&lt;h2&gt;
  
  
  Does a Block Theme Mean No PHP?
&lt;/h2&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;This is another misconception worth clearing up.&lt;/p&gt;

&lt;p&gt;WordPress is still a PHP application.&lt;/p&gt;

&lt;p&gt;Plugins can still register:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Custom post types&lt;/li&gt;
&lt;li&gt;Taxonomies&lt;/li&gt;
&lt;li&gt;REST API endpoints&lt;/li&gt;
&lt;li&gt;Hooks&lt;/li&gt;
&lt;li&gt;Filters&lt;/li&gt;
&lt;li&gt;Custom functionality&lt;/li&gt;
&lt;li&gt;Server-side logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'init'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="nf"&gt;register_post_type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'portfolio'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'public'&lt;/span&gt;   &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'label'&lt;/span&gt;    &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Portfolio'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'supports'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'title'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'editor'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'thumbnail'&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The difference is primarily in &lt;strong&gt;how the theme handles presentation and templates&lt;/strong&gt;, not that PHP suddenly disappears from WordPress.&lt;/p&gt;

&lt;p&gt;In fact, keeping application/business functionality in plugins rather than tying it tightly to the theme is often a useful architectural approach.&lt;/p&gt;




&lt;h2&gt;
  
  
  When Would I Still Choose a Classic Theme?
&lt;/h2&gt;

&lt;p&gt;This is where my own experience influences my answer.&lt;/p&gt;

&lt;p&gt;If I were working on an existing project that is already built around a classic theme and works well, I wouldn't automatically recommend rebuilding it as a block theme.&lt;/p&gt;

&lt;p&gt;There has to be a reason.&lt;/p&gt;

&lt;p&gt;For example, I'd be comfortable continuing with a classic theme when:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The existing architecture works
&lt;/h3&gt;

&lt;p&gt;If the site is stable, maintainable, and meeting the client's requirements, changing architecture just because a newer approach exists doesn't necessarily provide enough value.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The project relies heavily on custom PHP templates
&lt;/h3&gt;

&lt;p&gt;Some projects have complex template logic and custom integrations where the traditional PHP architecture is already a good fit.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. The team knows the classic architecture well
&lt;/h3&gt;

&lt;p&gt;Development speed and maintainability matter.&lt;/p&gt;

&lt;p&gt;If a team can build and maintain a classic theme efficiently, that has real value.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. The client doesn't need full Site Editor control
&lt;/h3&gt;

&lt;p&gt;If the website structure is intentionally controlled by developers, the biggest advantage of a block theme may not be necessary.&lt;/p&gt;




&lt;h2&gt;
  
  
  When Would I Consider a Block Theme?
&lt;/h2&gt;

&lt;p&gt;For a new project, however, I would definitely consider a block theme.&lt;/p&gt;

&lt;p&gt;Especially when:&lt;/p&gt;

&lt;h3&gt;
  
  
  The client wants visual control
&lt;/h3&gt;

&lt;p&gt;If the client wants to modify headers, footers, templates, and global styles without involving a developer, the Site Editor can be very useful.&lt;/p&gt;

&lt;h3&gt;
  
  
  The website is heavily block-based
&lt;/h3&gt;

&lt;p&gt;If the entire content strategy already revolves around Gutenberg, patterns, and blocks, a block theme can be a natural fit.&lt;/p&gt;

&lt;h3&gt;
  
  
  You want a centralized design system
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;theme.json&lt;/code&gt; provides a structured way to define colors, typography, spacing, layout, and other design settings.&lt;/p&gt;

&lt;h3&gt;
  
  
  You're building a new theme from scratch
&lt;/h3&gt;

&lt;p&gt;A new project gives you an opportunity to adopt the architecture without having to migrate years of existing code.&lt;/p&gt;

&lt;p&gt;WordPress's current Theme Handbook describes block themes as the modern method of building WordPress themes and says its theme-development documentation primarily focuses on this approach.&lt;/p&gt;




&lt;h2&gt;
  
  
  What About Performance?
&lt;/h2&gt;

&lt;p&gt;This is one area where I would avoid making absolute claims.&lt;/p&gt;

&lt;p&gt;You'll sometimes hear:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Block themes are faster."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Or:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Classic themes are faster."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Neither statement is universally true.&lt;/p&gt;

&lt;p&gt;Performance depends on the implementation.&lt;/p&gt;

&lt;p&gt;A poorly optimized block theme can be slow.&lt;/p&gt;

&lt;p&gt;A carefully built classic theme can be extremely fast.&lt;/p&gt;

&lt;p&gt;Things such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hosting&lt;/li&gt;
&lt;li&gt;Database queries&lt;/li&gt;
&lt;li&gt;Images&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;CSS&lt;/li&gt;
&lt;li&gt;Third-party scripts&lt;/li&gt;
&lt;li&gt;Plugins&lt;/li&gt;
&lt;li&gt;Caching&lt;/li&gt;
&lt;li&gt;Page complexity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;can all have a major impact.&lt;/p&gt;

&lt;p&gt;So I wouldn't choose a theme architecture based solely on the assumption that one is automatically faster.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Should a Classic-Theme Developer Learn?
&lt;/h2&gt;

&lt;p&gt;This is probably the question I'm asking myself as much as anyone reading this article.&lt;/p&gt;

&lt;p&gt;If you've already spent years learning classic WordPress development, should you throw all of that knowledge away?&lt;/p&gt;

&lt;p&gt;Definitely not.&lt;/p&gt;

&lt;p&gt;I would look at it as an expansion of your existing skills.&lt;/p&gt;

&lt;p&gt;A reasonable learning path could be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Classic WordPress Development
            ↓
       Gutenberg
            ↓
       Block Editor
            ↓
       theme.json
            ↓
       Block Patterns
            ↓
       Block Themes
            ↓
      Custom Blocks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your existing knowledge of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PHP&lt;/li&gt;
&lt;li&gt;WordPress hooks&lt;/li&gt;
&lt;li&gt;Filters&lt;/li&gt;
&lt;li&gt;Template hierarchy&lt;/li&gt;
&lt;li&gt;The Loop&lt;/li&gt;
&lt;li&gt;Custom post types&lt;/li&gt;
&lt;li&gt;REST APIs&lt;/li&gt;
&lt;li&gt;Plugins&lt;/li&gt;
&lt;li&gt;Security&lt;/li&gt;
&lt;li&gt;Performance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;doesn't become useless.&lt;/p&gt;

&lt;p&gt;You're simply adding another layer to your WordPress toolkit.&lt;/p&gt;




&lt;h2&gt;
  
  
  My Perspective as a WordPress Developer
&lt;/h2&gt;

&lt;p&gt;Most of my WordPress development experience has been with &lt;strong&gt;classic themes&lt;/strong&gt;, so I'm not going to pretend that I've spent the majority of my career building block themes.&lt;/p&gt;

&lt;p&gt;I haven't.&lt;/p&gt;

&lt;p&gt;But that's exactly why I found the evolution interesting.&lt;/p&gt;

&lt;p&gt;When you've been working with WordPress for years, it's easy to keep using the architecture you're comfortable with.&lt;/p&gt;

&lt;p&gt;And there is nothing wrong with that when the architecture is appropriate.&lt;/p&gt;

&lt;p&gt;But WordPress is clearly investing heavily in the block-based direction.&lt;/p&gt;

&lt;p&gt;The official Theme Handbook now describes block themes as the modern method of building themes and focuses its current guidance heavily on that approach.&lt;/p&gt;

&lt;p&gt;For me, that doesn't mean:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Classic themes are dead."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It means:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"As WordPress developers, we should understand where the platform is going, even if our current projects still use the architecture we're most experienced with."&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's the approach I'm taking.&lt;/p&gt;

&lt;p&gt;I'm not replacing my classic-theme knowledge.&lt;/p&gt;

&lt;p&gt;I'm expanding it.&lt;/p&gt;




&lt;h2&gt;
  
  
  So, Should You Switch?
&lt;/h2&gt;

&lt;p&gt;My answer is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It depends.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're maintaining an existing classic WordPress website that works well, I wouldn't migrate it simply because block themes are newer.&lt;/p&gt;

&lt;p&gt;If you're starting a new project, I'd at least evaluate whether a block theme makes sense.&lt;/p&gt;

&lt;p&gt;And if you're a WordPress developer who has mostly worked with classic themes, I'd definitely recommend learning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Block Editor
theme.json
Patterns
Template Parts
Site Editor
Block Themes
Custom Blocks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You don't need to become a block-theme expert overnight.&lt;/p&gt;

&lt;p&gt;But understanding the architecture will make it much easier to work with modern WordPress projects.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;WordPress theme development isn't necessarily a choice between:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Classic = Old
Block = New
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's more nuanced than that.&lt;/p&gt;

&lt;p&gt;Classic themes remain powerful and relevant.&lt;/p&gt;

&lt;p&gt;Block themes provide a newer approach that gives WordPress users much greater control over templates and site-wide design through blocks and the Site Editor.&lt;/p&gt;

&lt;p&gt;And &lt;code&gt;theme.json&lt;/code&gt; provides an interesting bridge between the two worlds because it can be used with both classic and block themes.&lt;/p&gt;

&lt;p&gt;For developers who have spent years working with classic themes, the goal shouldn't be to forget everything we already know.&lt;/p&gt;

&lt;p&gt;The goal is to understand the new architecture well enough to decide &lt;strong&gt;when it actually makes sense to use it&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That's where I currently see the value in learning block themes.&lt;/p&gt;

&lt;p&gt;Not because classic themes have suddenly become irrelevant—but because WordPress itself is evolving, and we should evolve with it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Official WordPress References
&lt;/h2&gt;

&lt;p&gt;This article is based primarily on the official WordPress Developer Documentation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;WordPress Theme Developer Handbook&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://developer.wordpress.org/themes/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/themes/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;What Is a Theme?&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://developer.wordpress.org/themes/getting-started/what-is-a-theme/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/themes/getting-started/what-is-a-theme/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Block Editor — Themes&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://developer.wordpress.org/block-editor/how-to-guides/themes/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/block-editor/how-to-guides/themes/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Introduction to &lt;code&gt;theme.json&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://developer.wordpress.org/themes/global-settings-and-styles/introduction-to-theme-json/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/themes/global-settings-and-styles/introduction-to-theme-json/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;theme.json&lt;/code&gt; Version 3 Reference&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-living/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-living/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Developing with &lt;code&gt;theme.json&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://developer.wordpress.org/block-editor/how-to-guides/themes/global-settings-and-styles/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/block-editor/how-to-guides/themes/global-settings-and-styles/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Classic Themes&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://developer.wordpress.org/themes/classic-themes/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/themes/classic-themes/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All technical claims and examples in this article should be checked against the official documentation for the WordPress version your project supports, particularly when working with &lt;code&gt;theme.json&lt;/code&gt; versions and schemas.&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>php</category>
      <category>webdev</category>
      <category>wordpress</category>
    </item>
    <item>
      <title>What's New in WordPress 7.0: Key Features and Improvements</title>
      <dc:creator>Muhammad Medhat</dc:creator>
      <pubDate>Wed, 08 Jul 2026 15:01:52 +0000</pubDate>
      <link>https://dev.to/muhammadmedhat/whats-new-in-wordpress-70-key-features-and-improvements-59e3</link>
      <guid>https://dev.to/muhammadmedhat/whats-new-in-wordpress-70-key-features-and-improvements-59e3</guid>
      <description>&lt;p&gt;WordPress 7.0, codenamed &lt;strong&gt;"Armstrong,"&lt;/strong&gt; was officially released on &lt;strong&gt;May 20, 2026&lt;/strong&gt;. This release focuses on improving publishing workflows, enhancing the editing experience, expanding AI infrastructure, and providing new tools for developers while maintaining WordPress's commitment to performance, accessibility, and extensibility.&lt;/p&gt;

&lt;h2&gt;
  
  
  AI Infrastructure in WordPress Core
&lt;/h2&gt;

&lt;p&gt;One of the biggest additions in WordPress 7.0 is the introduction of foundational AI infrastructure. Rather than providing a built-in AI writing assistant, WordPress now includes a standardized AI Client and connector framework that allows plugins and services to integrate AI capabilities in a consistent way. This approach gives developers a common foundation for building AI-powered features without tying WordPress to a specific AI provider.&lt;/p&gt;

&lt;h2&gt;
  
  
  Improved Publishing Workflows
&lt;/h2&gt;

&lt;p&gt;WordPress 7.0 introduces several workflow enhancements that make creating and managing content more efficient. The release streamlines common editorial tasks and improves the overall publishing experience, helping content creators spend less time navigating the interface and more time producing content.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enhanced Block Editor
&lt;/h2&gt;

&lt;p&gt;The Block Editor receives a variety of improvements aimed at making page building faster and more intuitive. Users benefit from a smoother editing experience, while new capabilities provide greater flexibility when designing pages and managing content layouts. These refinements continue WordPress's evolution toward a fully visual site-building experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Better Tools for Developers
&lt;/h2&gt;

&lt;p&gt;WordPress 7.0 includes numerous updates for plugin and theme developers. The release introduces new APIs and infrastructure that simplify extending WordPress while maintaining compatibility with existing development practices. The accompanying Field Guide outlines developer-focused enhancements and any important breaking changes developers should review before upgrading.&lt;/p&gt;

&lt;h2&gt;
  
  
  Performance, Accessibility, and Stability
&lt;/h2&gt;

&lt;p&gt;As with every major release, WordPress 7.0 includes performance optimizations, accessibility improvements, bug fixes, and security updates. These enhancements improve the overall user experience for both site visitors and administrators while ensuring WordPress remains reliable and maintainable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Upgrade to WordPress 7.0?
&lt;/h2&gt;

&lt;p&gt;Upgrading to WordPress 7.0 offers several benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Modern AI integration infrastructure for plugins and services.&lt;/li&gt;
&lt;li&gt;Improved publishing and editing workflows.&lt;/li&gt;
&lt;li&gt;Enhanced Block Editor experience.&lt;/li&gt;
&lt;li&gt;New developer APIs and extensibility improvements.&lt;/li&gt;
&lt;li&gt;Better performance, accessibility, and stability.&lt;/li&gt;
&lt;li&gt;Ongoing security and maintenance updates.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;WordPress 7.0 represents an important step forward for the platform by modernizing content creation workflows and laying the foundation for future AI-powered functionality. While many improvements are focused on infrastructure and developer experience, site owners and content creators also benefit from a smoother editing interface, improved performance, and a more efficient publishing process. Before upgrading, it's recommended to back up your website and verify that your themes and plugins are compatible with WordPress 7.0.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>wordpress</category>
      <category>backend</category>
      <category>web</category>
    </item>
    <item>
      <title>Container Queries: The CSS Feature I Wish I Had Years Ago</title>
      <dc:creator>Muhammad Medhat</dc:creator>
      <pubDate>Sun, 14 Jun 2026 15:02:41 +0000</pubDate>
      <link>https://dev.to/muhammadmedhat/container-queries-the-css-feature-i-wish-i-had-years-ago-2h63</link>
      <guid>https://dev.to/muhammadmedhat/container-queries-the-css-feature-i-wish-i-had-years-ago-2h63</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;For years, responsive design meant one thing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;768px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Media queries work great when you want to adapt a layout based on the viewport size.&lt;/p&gt;

&lt;p&gt;But what if a component lives inside a narrow sidebar on a large screen?&lt;/p&gt;

&lt;p&gt;Or inside a wide content area on a tablet?&lt;/p&gt;

&lt;p&gt;That's where Container Queries shine.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem With Media Queries
&lt;/h2&gt;

&lt;p&gt;Imagine a card component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    ...
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You want the card to switch layouts when it becomes too narrow.&lt;/p&gt;

&lt;p&gt;With media queries, you're forced to react to the viewport:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;768px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;.card&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The problem?&lt;/p&gt;

&lt;p&gt;The viewport may be large while the card's container is small.&lt;/p&gt;

&lt;p&gt;The component doesn't actually know how much space it has available.&lt;/p&gt;




&lt;h2&gt;
  
  
  Enter Container Queries
&lt;/h2&gt;

&lt;p&gt;Container Queries allow a component to respond to the size of its parent container rather than the viewport.&lt;/p&gt;

&lt;p&gt;First, define a container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.cards-wrapper&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="py"&gt;container-type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;inline-size&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then create queries based on that container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@container&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;500px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;.card&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the card adapts based on the space it actually has.&lt;/p&gt;




&lt;h2&gt;
  
  
  A Real Example
&lt;/h2&gt;

&lt;p&gt;Imagine a product card:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"products"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"product-card"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"product.jpg"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"content"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Product Name&lt;span class="nt"&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Description&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Default layout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.product-card&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="py"&gt;gap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make the parent a container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.products&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="py"&gt;container-type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;inline-size&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change layout when space becomes limited:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@container&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;450px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;.product-card&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The card becomes fully reusable regardless of where it's placed.&lt;/p&gt;




&lt;h2&gt;
  
  
  When I Use Container Queries
&lt;/h2&gt;

&lt;p&gt;I find them most useful for reusable components like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Product cards&lt;/li&gt;
&lt;li&gt;Team member cards&lt;/li&gt;
&lt;li&gt;Dashboard widgets&lt;/li&gt;
&lt;li&gt;Pricing tables&lt;/li&gt;
&lt;li&gt;Sidebar blocks&lt;/li&gt;
&lt;li&gt;Custom WordPress blocks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of designing around the page, you design around the component itself.&lt;/p&gt;




&lt;h2&gt;
  
  
  Container Queries vs Media Queries
&lt;/h2&gt;

&lt;p&gt;Use Media Queries when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adjusting page layouts&lt;/li&gt;
&lt;li&gt;Changing navigation behavior&lt;/li&gt;
&lt;li&gt;Responding to viewport size&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use Container Queries when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Building reusable components&lt;/li&gt;
&lt;li&gt;Creating modular UI systems&lt;/li&gt;
&lt;li&gt;Designing components that appear in different layouts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I don't see them as competitors.&lt;/p&gt;

&lt;p&gt;They solve different problems and often work together.&lt;/p&gt;




&lt;h2&gt;
  
  
  Browser Support
&lt;/h2&gt;

&lt;p&gt;Container Queries are now supported in all modern browsers, making them practical for production projects.&lt;/p&gt;

&lt;p&gt;Always verify support requirements if you're targeting older browsers, but for most modern projects they're ready to use.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Container Queries changed the way I think about responsive design.&lt;/p&gt;

&lt;p&gt;Instead of asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"How wide is the screen?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I can ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"How much space does this component actually have?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That small shift makes components more reusable, predictable, and easier to maintain.&lt;/p&gt;

&lt;p&gt;If you're still relying only on media queries, Container Queries are definitely worth adding to your CSS toolbox.&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>html</category>
      <category>frontend</category>
    </item>
    <item>
      <title>🧠 AI Tools That Actually Help Developers (And How I Use Them Daily)</title>
      <dc:creator>Muhammad Medhat</dc:creator>
      <pubDate>Mon, 06 Apr 2026 16:28:42 +0000</pubDate>
      <link>https://dev.to/muhammadmedhat/ai-tools-that-actually-help-developers-and-how-i-use-them-daily-1ndj</link>
      <guid>https://dev.to/muhammadmedhat/ai-tools-that-actually-help-developers-and-how-i-use-them-daily-1ndj</guid>
      <description>&lt;p&gt;There’s no shortage of AI tools right now.&lt;/p&gt;

&lt;p&gt;Every week, a new tool promises to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Replace developers&lt;/li&gt;
&lt;li&gt;Build full apps in seconds&lt;/li&gt;
&lt;li&gt;10x your productivity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But if you’re actually working on real projects, you already know the truth:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Most of these tools don’t fit into your daily workflow.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So instead of another “Top 7 AI Tools” list, this is something more practical:&lt;/p&gt;

&lt;p&gt;👉 The AI tools I actually use as a developer&lt;br&gt;
👉 And how they fit into real work — especially in WordPress projects&lt;/p&gt;


&lt;h2&gt;
  
  
  🚀 ChatGPT — My Daily Development Assistant
&lt;/h2&gt;

&lt;p&gt;Out of all the tools, this is the one I use the most.&lt;/p&gt;

&lt;p&gt;Not because it’s magical —&lt;br&gt;
But because it saves time where it actually matters.&lt;/p&gt;
&lt;h3&gt;
  
  
  How I use it daily:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Debugging WordPress issues&lt;/li&gt;
&lt;li&gt;Writing and fixing PHP functions&lt;/li&gt;
&lt;li&gt;Understanding hooks and filters faster&lt;/li&gt;
&lt;li&gt;Refactoring messy code&lt;/li&gt;
&lt;li&gt;Generating starting points instead of searching for hours&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Opening 5 tabs, reading random answers, testing blindly…&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I describe the problem clearly and iterate.&lt;/p&gt;


&lt;h3&gt;
  
  
  🔧 Real Example from My Workflow
&lt;/h3&gt;

&lt;p&gt;Let’s say I need:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A custom WooCommerce function to modify checkout fields&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Before:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Search&lt;/li&gt;
&lt;li&gt;Read documentation&lt;/li&gt;
&lt;li&gt;Try multiple snippets&lt;/li&gt;
&lt;li&gt;Debug manually&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I ask ChatGPT&lt;/li&gt;
&lt;li&gt;Get a working draft&lt;/li&gt;
&lt;li&gt;Adjust it based on my project&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 What used to take an hour can take minutes&lt;/p&gt;


&lt;h3&gt;
  
  
  🎥 See It in Action
&lt;/h3&gt;

&lt;p&gt;If you want to see how I actually use ChatGPT during real development work, I made a full video where I walk through practical examples step by step:&lt;/p&gt;

&lt;p&gt;👉 &lt;em&gt;  &lt;iframe src="https://www.youtube.com/embed/sZdVSzbEnCw"&gt;
  &lt;/iframe&gt;
&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This isn’t a “look what AI can do” demo —&lt;br&gt;
It’s how I use it inside real projects.&lt;/p&gt;


&lt;h2&gt;
  
  
  ⚙️ AI Inside the Tools You Already Use
&lt;/h2&gt;

&lt;p&gt;One thing many developers miss:&lt;/p&gt;

&lt;p&gt;AI isn’t just standalone tools anymore —&lt;br&gt;
It’s built into the tools you already use.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub Copilot → speeds up repetitive coding&lt;/li&gt;
&lt;li&gt;IDE AI assistants → smarter suggestions&lt;/li&gt;
&lt;li&gt;Canva AI → quick visuals for content or clients&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These aren’t revolutionary on their own —&lt;br&gt;
But they remove friction.&lt;/p&gt;

&lt;p&gt;👉 And removing friction is what actually improves your workflow&lt;/p&gt;


&lt;h2&gt;
  
  
  🧩 AI for Learning (Faster Than Documentation Alone)
&lt;/h2&gt;

&lt;p&gt;AI changed how I learn new things.&lt;/p&gt;

&lt;p&gt;Before:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Long documentation&lt;/li&gt;
&lt;li&gt;Multiple tutorials&lt;/li&gt;
&lt;li&gt;Slow trial and error&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I ask specific questions&lt;/li&gt;
&lt;li&gt;Get simplified explanations&lt;/li&gt;
&lt;li&gt;Request real examples&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Explain WordPress hooks with a real use case”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;👉 You go from confusion to clarity much faster&lt;/p&gt;

&lt;p&gt;But this leads to something important…&lt;/p&gt;


&lt;h2&gt;
  
  
  📄 Documentation Still Matters (More Than Ever)
&lt;/h2&gt;

&lt;p&gt;There’s a common misconception:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“AI replaces documentation”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It doesn’t.&lt;/p&gt;

&lt;p&gt;In my workflow, documentation is still essential —&lt;br&gt;
Sometimes even more than before.&lt;/p&gt;


&lt;h3&gt;
  
  
  🔍 Why I Still Check Documentation
&lt;/h3&gt;

&lt;p&gt;Even when I use ChatGPT, I don’t blindly trust the output.&lt;/p&gt;

&lt;p&gt;If I’m working with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WordPress hooks&lt;/li&gt;
&lt;li&gt;WooCommerce customization&lt;/li&gt;
&lt;li&gt;APIs or integrations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I always go back to documentation to confirm:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Are the hooks correct?&lt;/li&gt;
&lt;li&gt;Is this the recommended approach?&lt;/li&gt;
&lt;li&gt;Is there a better or more optimized way?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Because AI can give you something that &lt;em&gt;works&lt;/em&gt;&lt;br&gt;
But not always something that’s &lt;em&gt;correct&lt;/em&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  ⚠️ What AI Gets Wrong
&lt;/h3&gt;

&lt;p&gt;From real experience, AI can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Suggest outdated functions&lt;/li&gt;
&lt;li&gt;Miss small but critical details&lt;/li&gt;
&lt;li&gt;Ignore performance considerations&lt;/li&gt;
&lt;li&gt;Provide solutions that don’t scale&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And if you skip documentation,&lt;br&gt;
you won’t even notice.&lt;/p&gt;


&lt;h3&gt;
  
  
  🧠 My Real Workflow (AI + Documentation)
&lt;/h3&gt;

&lt;p&gt;This is how I actually work:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use AI → to get direction or a draft&lt;/li&gt;
&lt;li&gt;Review → based on my experience&lt;/li&gt;
&lt;li&gt;Check documentation → verify accuracy&lt;/li&gt;
&lt;li&gt;Improve → based on project needs&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;👉 AI gives speed&lt;br&gt;
👉 Documentation gives certainty&lt;/p&gt;

&lt;p&gt;You need both.&lt;/p&gt;


&lt;h2&gt;
  
  
  🛠️ AI for Repetitive Work
&lt;/h2&gt;

&lt;p&gt;Where AI really shines isn’t complex architecture.&lt;/p&gt;

&lt;p&gt;It’s repetitive work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Writing similar functions&lt;/li&gt;
&lt;li&gt;Generating variations of code&lt;/li&gt;
&lt;li&gt;Formatting data&lt;/li&gt;
&lt;li&gt;Creating dummy content&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 It removes the work you don’t want to do anyway&lt;br&gt;
So you can focus on what actually matters&lt;/p&gt;


&lt;h2&gt;
  
  
  ⚠️ What AI Still Can’t Do
&lt;/h2&gt;

&lt;p&gt;AI is powerful — but it’s not reliable on its own.&lt;/p&gt;

&lt;p&gt;It doesn’t:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understand your full project context&lt;/li&gt;
&lt;li&gt;Make architectural decisions&lt;/li&gt;
&lt;li&gt;Guarantee best practices&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s why:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;AI doesn’t replace developers — it amplifies them&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you understand the fundamentals,&lt;br&gt;
AI makes you faster and more effective.&lt;/p&gt;

&lt;p&gt;If not?&lt;/p&gt;

&lt;p&gt;It just makes mistakes faster.&lt;/p&gt;


&lt;h2&gt;
  
  
  🔥 The Real Advantage
&lt;/h2&gt;

&lt;p&gt;The developers getting real value from AI aren’t:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The ones trying every new tool&lt;/li&gt;
&lt;li&gt;Or chasing trends&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They’re the ones who:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integrate AI into their workflow&lt;/li&gt;
&lt;li&gt;Ask better questions&lt;/li&gt;
&lt;li&gt;Verify and refine the output&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  🧠 Final Thought
&lt;/h2&gt;

&lt;p&gt;AI tools are everywhere.&lt;/p&gt;

&lt;p&gt;But the goal isn’t to use more tools.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It’s to work smarter with the right ones.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For me, that starts with ChatGPT —&lt;br&gt;
supported by experience, and grounded in documentation.&lt;/p&gt;


&lt;h2&gt;
  
  
  👉 Want to See more AI Tools?
&lt;/h2&gt;

&lt;p&gt;🎥 Check out my youtube channel:&lt;br&gt;
 &lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://www.youtube.com/@ClarityAIStudio" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fyt3.googleusercontent.com%2F38ifKfDd0bWcqYbZ6CmZhpA3gIi8F2z5LVSfYV6t9kfz67RPCoaSbDT8rEYg3Rb4GjiTlh89-g%3Ds900-c-k-c0x00ffffff-no-rj" height="900" class="m-0" width="900"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://www.youtube.com/@ClarityAIStudio" rel="noopener noreferrer" class="c-link"&gt;
            Clarity AI Studio - YouTube
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Welcome to Clarity AI Studio — where artificial intelligence is made clear, practical, and easy to use.

This channel is dedicated to breaking down complex AI tools into simple, step-by-step tutorials anyone can follow. Whether you're a student, professional, entrepreneur, or small business owner, you'll learn how to use AI to save time, boost productivity, and work smarter.

We cover:

• AI tools explained simply
• Step-by-step tutorials
• Productivity and automation workflows
• AI for small businesses and creators
• Practical use cases you can apply immediately

No hype. No complicated jargon. Just clear explanations and real-world applications.

Understand AI. Use AI. Stay ahead.

          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.youtube.com%2Fs%2Fdesktop%2Ffd6720bf%2Fimg%2Ffavicon.ico" width="16" height="16"&gt;
          youtube.com
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>webdev</category>
      <category>ai</category>
      <category>wordpress</category>
    </item>
    <item>
      <title>AI Didn’t Replace Web Developers — It Made Good Ones Stronger</title>
      <dc:creator>Muhammad Medhat</dc:creator>
      <pubDate>Tue, 10 Mar 2026 22:37:56 +0000</pubDate>
      <link>https://dev.to/muhammadmedhat/ai-didnt-replace-web-developers-it-made-good-ones-stronger-535p</link>
      <guid>https://dev.to/muhammadmedhat/ai-didnt-replace-web-developers-it-made-good-ones-stronger-535p</guid>
      <description>&lt;p&gt;When AI coding tools started becoming popular, a lot of predictions appeared online:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“AI will replace developers.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But after actually using these tools in real development work, something else became clear.&lt;/p&gt;

&lt;p&gt;AI didn’t replace web developers.&lt;/p&gt;

&lt;p&gt;Instead, it helped many developers become &lt;strong&gt;more productive, faster, and sometimes even better at solving problems&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The real difference isn’t whether developers use AI.&lt;br&gt;
It’s &lt;strong&gt;how they use it&lt;/strong&gt;.&lt;/p&gt;


&lt;h1&gt;
  
  
  AI Works Best With Developers, Not Instead of Them
&lt;/h1&gt;

&lt;p&gt;AI can generate code, explain concepts, and suggest solutions.&lt;/p&gt;

&lt;p&gt;But it still depends on the developer to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;understand the system&lt;/li&gt;
&lt;li&gt;review the generated code&lt;/li&gt;
&lt;li&gt;integrate it into a real project&lt;/li&gt;
&lt;li&gt;debug issues when things go wrong&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In practice, AI works best as &lt;strong&gt;a development assistant&lt;/strong&gt;, not a replacement.&lt;/p&gt;

&lt;p&gt;The developers who benefit the most are the ones who already understand what they’re building.&lt;/p&gt;


&lt;h1&gt;
  
  
  Real Examples From My WordPress Workflow
&lt;/h1&gt;

&lt;p&gt;In my daily WordPress development work, AI has become a useful assistant in several situations.&lt;/p&gt;

&lt;p&gt;Not as a replacement — but as something that &lt;strong&gt;removes friction from repetitive or time-consuming tasks&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here are a few practical examples.&lt;/p&gt;


&lt;h2&gt;
  
  
  1. Debugging Hook Timing Issues
&lt;/h2&gt;

&lt;p&gt;Sometimes a WordPress hook doesn’t fire the way you expect.&lt;/p&gt;

&lt;p&gt;For example, a callback attached to &lt;code&gt;init&lt;/code&gt; might run too early or too late depending on what the code needs.&lt;/p&gt;

&lt;p&gt;Instead of manually searching documentation or browsing multiple threads, I can quickly ask AI something like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Why might a WordPress hook not fire as expected?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It usually suggests things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;checking hook priority&lt;/li&gt;
&lt;li&gt;verifying execution order&lt;/li&gt;
&lt;li&gt;confirming the hook exists in the current request&lt;/li&gt;
&lt;li&gt;making sure the code runs after plugins load&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It doesn’t fix the problem automatically, but it often &lt;strong&gt;points me in the right direction faster&lt;/strong&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  2. Generating Plugin Boilerplate
&lt;/h2&gt;

&lt;p&gt;When starting a new feature or plugin, there is always repetitive setup work.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;plugin headers&lt;/li&gt;
&lt;li&gt;basic structure&lt;/li&gt;
&lt;li&gt;registering hooks&lt;/li&gt;
&lt;li&gt;creating activation functions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of starting from an empty file every time, AI can generate a simple starting point.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a basic plugin structure&lt;/li&gt;
&lt;li&gt;a small admin settings page&lt;/li&gt;
&lt;li&gt;registering actions and filters&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The generated code is rarely perfect, but it &lt;strong&gt;removes the blank-page problem&lt;/strong&gt; and speeds up the first steps.&lt;/p&gt;


&lt;h2&gt;
  
  
  3. Understanding Old or Unfamiliar Code
&lt;/h2&gt;

&lt;p&gt;WordPress developers often work with older projects or code written by other developers.&lt;/p&gt;

&lt;p&gt;Sometimes you encounter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;very long functions&lt;/li&gt;
&lt;li&gt;complex filters&lt;/li&gt;
&lt;li&gt;unusual logic&lt;/li&gt;
&lt;li&gt;legacy code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AI can help summarize what a piece of code is doing before you dive deeper.&lt;/p&gt;

&lt;p&gt;For example, asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“What does this function do?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This doesn’t replace reading the code, but it helps &lt;strong&gt;understand the context faster&lt;/strong&gt;, especially in large codebases.&lt;/p&gt;


&lt;h2&gt;
  
  
  4. Exploring Alternative Implementations
&lt;/h2&gt;

&lt;p&gt;Sometimes a solution works, but you still want to check if there’s a &lt;strong&gt;cleaner or more efficient approach&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;alternative ways to structure a WordPress plugin&lt;/li&gt;
&lt;li&gt;different ways to filter a query&lt;/li&gt;
&lt;li&gt;optimizing loops or database queries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AI can generate alternative ideas quickly.&lt;/p&gt;

&lt;p&gt;The developer still decides what to keep, but it helps &lt;strong&gt;explore options faster&lt;/strong&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  5. Testing Small Ideas Quickly
&lt;/h2&gt;

&lt;p&gt;For quick experiments, I often test ideas using &lt;strong&gt;WP-CLI&lt;/strong&gt;.&lt;br&gt;
you can read articles about &lt;a href="https://dev.to/muhammadmedhat/simple-wp-cli-commands-that-make-wordpress-easier-1cko"&gt;Simple WP-CLI Commands&lt;/a&gt; for more info&lt;/p&gt;

&lt;p&gt;For example, triggering hooks directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s1"&gt;'do_action("my_plugin_custom_hook");'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;AI can help quickly draft small snippets for things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;temporary debugging code&lt;/li&gt;
&lt;li&gt;logging hooks&lt;/li&gt;
&lt;li&gt;small PHP checks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes it easier to &lt;strong&gt;experiment without interrupting the development flow&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Real Skill That Matters
&lt;/h1&gt;

&lt;p&gt;AI becomes most useful when developers already understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;programming fundamentals&lt;/li&gt;
&lt;li&gt;debugging&lt;/li&gt;
&lt;li&gt;system architecture&lt;/li&gt;
&lt;li&gt;performance considerations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without those skills, AI-generated code can be confusing or even harmful.&lt;/p&gt;

&lt;p&gt;But with strong fundamentals, AI becomes a &lt;strong&gt;force multiplier&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It removes repetitive work and allows developers to focus more on solving real problems.&lt;/p&gt;




&lt;h1&gt;
  
  
  How AI Is Actually Changing Development
&lt;/h1&gt;

&lt;p&gt;AI is definitely changing the development workflow.&lt;/p&gt;

&lt;p&gt;Tasks that once required long searches through documentation can now happen much faster:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;generating boilerplate code&lt;/li&gt;
&lt;li&gt;explaining unfamiliar syntax&lt;/li&gt;
&lt;li&gt;suggesting debugging steps&lt;/li&gt;
&lt;li&gt;exploring implementation ideas&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But the developer still remains responsible for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;understanding the problem&lt;/li&gt;
&lt;li&gt;making technical decisions&lt;/li&gt;
&lt;li&gt;reviewing generated code&lt;/li&gt;
&lt;li&gt;maintaining the system long-term&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AI speeds up development — it doesn’t replace the thinking behind it.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;AI didn’t eliminate the need for web developers.&lt;/p&gt;

&lt;p&gt;Instead, it became another powerful tool in the development toolbox.&lt;/p&gt;

&lt;p&gt;Developers who learn how to use it effectively can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;work faster&lt;/li&gt;
&lt;li&gt;experiment more&lt;/li&gt;
&lt;li&gt;reduce repetitive tasks&lt;/li&gt;
&lt;li&gt;focus more on real problem solving&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the end, AI doesn’t replace developers.&lt;/p&gt;

&lt;p&gt;It helps the ones who adapt become &lt;strong&gt;stronger and more productive&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>wordpress</category>
      <category>php</category>
    </item>
    <item>
      <title>Understanding WordPress Execution Order (Who Runs First and Why Your Code Fails Sometimes)</title>
      <dc:creator>Muhammad Medhat</dc:creator>
      <pubDate>Wed, 11 Feb 2026 22:23:19 +0000</pubDate>
      <link>https://dev.to/muhammadmedhat/understanding-wordpress-execution-order-who-runs-first-and-why-your-code-fails-sometimes-487l</link>
      <guid>https://dev.to/muhammadmedhat/understanding-wordpress-execution-order-who-runs-first-and-why-your-code-fails-sometimes-487l</guid>
      <description>&lt;p&gt;A lot of WordPress “bugs” are not really bugs.&lt;/p&gt;

&lt;p&gt;They’re this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“My code is fine, but it’s running at the wrong time.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you understand &lt;strong&gt;when&lt;/strong&gt; WordPress loads plugins, themes, and hooks, you can avoid a huge class of problems: things not showing, filters not firing, or options not being available yet.&lt;/p&gt;

&lt;p&gt;This article walks through &lt;strong&gt;execution order in a practical way&lt;/strong&gt;, with real hooks and examples.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Big Picture: What Loads First?
&lt;/h2&gt;

&lt;p&gt;When a page loads in WordPress, this is (roughly) what happens:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;WordPress core boots up&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Must-use plugins (mu-plugins)&lt;/strong&gt; load&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Regular plugins&lt;/strong&gt; load&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;current theme&lt;/strong&gt; loads&lt;/li&gt;
&lt;li&gt;Important &lt;strong&gt;core hooks&lt;/strong&gt; fire (like &lt;code&gt;init&lt;/code&gt;, &lt;code&gt;wp_loaded&lt;/code&gt;, etc.)&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;template&lt;/strong&gt; is chosen and rendered&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You don’t need to memorize every internal step, but you do need one key idea:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If your code depends on something, make sure it runs &lt;em&gt;after&lt;/em&gt; that thing is loaded.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  2. Key Hooks in the Early Lifecycle
&lt;/h2&gt;

&lt;p&gt;Let’s look at a few hooks you’ll see all the time, and what they’re good for.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;code&gt;plugins_loaded&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'plugins_loaded'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Check if other plugins are active&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When it fires:&lt;/strong&gt;&lt;br&gt;
After all active plugins have been loaded.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use it when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your plugin depends on another plugin (e.g. WooCommerce, ACF)&lt;/li&gt;
&lt;li&gt;You want to check if a plugin is active before using its functions&lt;/li&gt;
&lt;li&gt;You’re writing compatibility code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'plugins_loaded'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nb"&gt;class_exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'WooCommerce'&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Safe to run WooCommerce-related code&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;code&gt;init&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'init'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Register CPTs, taxonomies, etc.&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When it fires:&lt;/strong&gt;&lt;br&gt;
After WordPress is loaded, but before any headers are sent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use it when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Registering &lt;strong&gt;Custom Post Types&lt;/strong&gt; and &lt;strong&gt;taxonomies&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Adding rewrite rules&lt;/li&gt;
&lt;li&gt;Setting up things that must be ready early in the request&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is one of the most commonly used hooks in WordPress.&lt;/p&gt;


&lt;h3&gt;
  
  
  &lt;code&gt;wp_loaded&lt;/code&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'wp_loaded'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Code that needs everything initialized&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;When it fires:&lt;/strong&gt;&lt;br&gt;
After WordPress, plugins, and the theme have all been loaded.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use it when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;init&lt;/code&gt; is too early for what you’re doing&lt;/li&gt;
&lt;li&gt;You need &lt;em&gt;everything&lt;/em&gt; available before your code runs&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  3. Theme-Specific Hooks
&lt;/h2&gt;

&lt;p&gt;When you’re working on themes (or plugins that depend on theme behavior), these hooks matter a lot.&lt;/p&gt;


&lt;h3&gt;
  
  
  &lt;code&gt;after_setup_theme&lt;/code&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'after_setup_theme'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;add_theme_support&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'post-thumbnails'&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;When it fires:&lt;/strong&gt;&lt;br&gt;
Right after the active theme is loaded.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use it when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adding &lt;code&gt;add_theme_support()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Registering nav menus&lt;/li&gt;
&lt;li&gt;Doing high-level theme setup&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;
  
  
  &lt;code&gt;wp_enqueue_scripts&lt;/code&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'wp_enqueue_scripts'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;wp_enqueue_style&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'my-theme'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;get_stylesheet_uri&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;When it fires:&lt;/strong&gt;&lt;br&gt;
When WordPress is ready to enqueue scripts and styles for the frontend.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use it when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enqueuing CSS and JS files for your theme or plugin&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your styles/scripts aren’t loading or are in the wrong place, check if you’re using this hook correctly.&lt;/p&gt;


&lt;h2&gt;
  
  
  4. Hook Priority: Same Hook, Different Order
&lt;/h2&gt;

&lt;p&gt;Sometimes you hook into the &lt;strong&gt;same hook&lt;/strong&gt; as someone else, but you still need to control &lt;em&gt;who runs first&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;That’s where priority comes in.&lt;/p&gt;

&lt;p&gt;Default priority is &lt;code&gt;10&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'init'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'my_function'&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;           &lt;span class="c1"&gt;// priority 10&lt;/span&gt;
&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'init'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'my_other_function'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// priority 20&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lower = earlier. Higher = later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'init'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;error_log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'I run first'&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'init'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;error_log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'I run second'&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When you care about priority:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You want to &lt;strong&gt;override&lt;/strong&gt; something another plugin or theme did&lt;/li&gt;
&lt;li&gt;You need to &lt;strong&gt;modify data after someone else touched it&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;You want to make sure your code &lt;strong&gt;doesn’t run too early&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. Common “Execution Order” Problems (and Why They Happen)
&lt;/h2&gt;

&lt;p&gt;Let’s connect this to real-life issues you’ve probably seen.&lt;/p&gt;




&lt;h3&gt;
  
  
  Problem 1: “My Custom Post Type 404s”
&lt;/h3&gt;

&lt;p&gt;You:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Register a CPT somewhere random (like at the bottom of &lt;code&gt;functions.php&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Visit the CPT archive and get a 404&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Likely cause:&lt;/strong&gt;&lt;br&gt;
CPT is not registered on &lt;code&gt;init&lt;/code&gt; (or not on every request), so rewrite rules and queries don’t know about it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'init'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'register_books_cpt'&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Problem 2: “I’m Getting ‘Call to undefined function’ From Another Plugin”
&lt;/h3&gt;

&lt;p&gt;You:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Call a function from WooCommerce or another plugin&lt;/li&gt;
&lt;li&gt;Code runs too early&lt;/li&gt;
&lt;li&gt;Function doesn’t exist yet&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Likely cause:&lt;/strong&gt;&lt;br&gt;
You are running before &lt;code&gt;plugins_loaded&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'plugins_loaded'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'my_plugin_compat'&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Problem 3: “My Script Isn’t Loading Where I Expect”
&lt;/h3&gt;

&lt;p&gt;You:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;wp_enqueue_script()&lt;/code&gt; directly in &lt;code&gt;functions.php&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;It loads in weird places, or not at all&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Likely cause:&lt;/strong&gt;&lt;br&gt;
Scripts are not enqueued on &lt;code&gt;wp_enqueue_scripts&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'wp_enqueue_scripts'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'my_theme_assets'&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  6. A Simple Mental Model
&lt;/h2&gt;

&lt;p&gt;You don’t need to memorize every hook, but this mental model helps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Core boots
↓
Plugins load      (plugins_loaded)
↓
Theme loads       (after_setup_theme)
↓
WordPress “ready” (init, wp_loaded)
↓
Assets phase      (wp_enqueue_scripts)
↓
Template chosen   (template_redirect, etc.)
↓
Page output
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ask yourself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“At this point in the timeline, does what I need already exist?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If not, you’re probably on the wrong hook.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Quick Debugging Techniques
&lt;/h2&gt;

&lt;p&gt;When something doesn’t work, instead of only checking your logic, check your &lt;strong&gt;timing&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A few easy tricks:&lt;/p&gt;

&lt;h3&gt;
  
  
  1) Log when a hook fires
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'init'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;error_log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'init fired'&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check &lt;code&gt;wp-content/debug.log&lt;/code&gt; to confirm.&lt;/p&gt;




&lt;h3&gt;
  
  
  2) Temporarily change hooks
&lt;/h3&gt;

&lt;p&gt;Try moving your code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;from &lt;code&gt;init&lt;/code&gt; → &lt;code&gt;wp_loaded&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;from constructor → &lt;code&gt;init&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;from random place → &lt;code&gt;plugins_loaded&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If it starts working, your problem was timing, not code.&lt;/p&gt;




&lt;h3&gt;
  
  
  3) Dump the call stack (for deeper debugging)
&lt;/h3&gt;

&lt;p&gt;If you’re more advanced, tools like Xdebug or &lt;code&gt;debug_backtrace()&lt;/code&gt; help you see &lt;strong&gt;how&lt;/strong&gt; you got to a certain hook.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Understanding &lt;strong&gt;when&lt;/strong&gt; WordPress runs your code is one of those skills that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;prevents subtle bugs&lt;/li&gt;
&lt;li&gt;makes debugging less painful&lt;/li&gt;
&lt;li&gt;helps you work better with other plugins and themes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After a while, you’ll stop thinking “WordPress is weird” and start thinking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Ah, my code is just running too early / too late.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That’s a much easier problem to fix.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>wordpress</category>
      <category>wphooks</category>
      <category>php</category>
    </item>
    <item>
      <title>Simple WP-CLI Commands That Make WordPress Easier</title>
      <dc:creator>Muhammad Medhat</dc:creator>
      <pubDate>Sat, 17 Jan 2026 16:44:03 +0000</pubDate>
      <link>https://dev.to/muhammadmedhat/simple-wp-cli-commands-that-make-wordpress-easier-1cko</link>
      <guid>https://dev.to/muhammadmedhat/simple-wp-cli-commands-that-make-wordpress-easier-1cko</guid>
      <description>&lt;p&gt;WP-CLI isn’t just for advanced developers.&lt;br&gt;
Even for &lt;strong&gt;basic WordPress tasks&lt;/strong&gt;, it can save time and reduce a lot of clicking around in the dashboard.&lt;/p&gt;

&lt;p&gt;If you already know what WP-CLI is and how to install it, here are &lt;strong&gt;simple, everyday commands&lt;/strong&gt; I use to manage WordPress sites faster.&lt;/p&gt;


&lt;h2&gt;
  
  
  1) Check Basic Site Info (First Thing I Run)
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp option get siteurl
wp option get home
wp core version
wp user list &lt;span class="nt"&gt;--fields&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ID,user_login,roles
wp theme list &lt;span class="nt"&gt;--status&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;active
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
Right after connecting to a server, or before doing any changes.&lt;/p&gt;

&lt;p&gt;Why:&lt;br&gt;
This gives you a quick picture of the site without opening wp-admin:&lt;/p&gt;

&lt;p&gt;Which site URL you’re on&lt;/p&gt;

&lt;p&gt;Which WordPress version is running&lt;/p&gt;

&lt;p&gt;Who the users are (and their roles)&lt;/p&gt;

&lt;p&gt;Which theme is active&lt;/p&gt;
&lt;h2&gt;
  
  
  It’s an easy way to make sure you’re in the right place and understand the setup before touching anything.
&lt;/h2&gt;
&lt;h2&gt;
  
  
  2) See Active Plugins
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp plugin list &lt;span class="nt"&gt;--status&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;active
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
When a site is slow or acting weird and you want to know what’s running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;
Much faster than opening the Plugins page in wp-admin.&lt;/p&gt;


&lt;h2&gt;
  
  
  3) Disable or Enable a Plugin
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp plugin deactivate plugin-slug
wp plugin activate plugin-slug
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
A plugin causes errors, white screens, or conflicts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;
You can fix problems even if wp-admin is broken.&lt;/p&gt;


&lt;h2&gt;
  
  
  4) Update WordPress Core
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp core update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
WordPress shows an update notification.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;
It’s quick, reliable, and avoids browser timeouts.&lt;/p&gt;


&lt;h2&gt;
  
  
  5) Update Plugins and Themes
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp plugin update &lt;span class="nt"&gt;--all&lt;/span&gt;
wp theme update &lt;span class="nt"&gt;--all&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
Doing regular maintenance or security updates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;
One command replaces many clicks.&lt;/p&gt;


&lt;h2&gt;
  
  
  6) Fix Permalink Problems
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp rewrite flush &lt;span class="nt"&gt;--hard&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
Pages suddenly show 404 errors after changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;
Same as re-saving permalinks in settings, just faster.&lt;/p&gt;


&lt;h2&gt;
  
  
  7) Clear Cached Data
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp transient delete &lt;span class="nt"&gt;--all&lt;/span&gt;
wp cache flush
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
You changed something but the site still shows old data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;
Clears temporary stored values that cause confusion.&lt;/p&gt;


&lt;h2&gt;
  
  
  8) Enable Maintenance Mode
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp maintenance-mode activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Disable it when finished:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp maintenance-mode deactivate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
Making quick updates or small migrations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;
Stops visitors from seeing half-finished changes.&lt;/p&gt;


&lt;h2&gt;
  
  
  9) Create a New User
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp user create editor1 editor@example.com &lt;span class="nt"&gt;--role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;editor &lt;span class="nt"&gt;--user_pass&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'Password123'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
You need to add a user quickly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;
No forms, no waiting for email confirmations.&lt;/p&gt;


&lt;h2&gt;
  
  
  10) Reset a User Password
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp user update editor1 &lt;span class="nt"&gt;--user_pass&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'NewPassword123'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
Someone can’t log in and email isn’t working.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;
Instant fix without touching wp-admin.&lt;/p&gt;


&lt;h2&gt;
  
  
  11) List Pages or Posts
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp post list &lt;span class="nt"&gt;--post_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;page
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
You want a quick overview of site content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;
Faster than browsing multiple admin screens.&lt;/p&gt;


&lt;h2&gt;
  
  
  12) List Media Files (Attachments)
&lt;/h2&gt;

&lt;p&gt;Media files in WordPress are stored as &lt;strong&gt;attachments&lt;/strong&gt;, so you list them like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp post list &lt;span class="nt"&gt;--post_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;attachment &lt;span class="nt"&gt;--fields&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ID,post_title,guid &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
After a migration or when uploads look wrong.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;
Gives you a clear list of media without opening the Media Library.&lt;/p&gt;




&lt;h2&gt;
  
  
  Important Note About &lt;code&gt;wp media&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;You &lt;strong&gt;can’t use &lt;code&gt;wp media list&lt;/code&gt;&lt;/strong&gt; to list uploads.&lt;br&gt;
That command does &lt;strong&gt;not exist&lt;/strong&gt; in core WP-CLI.&lt;/p&gt;

&lt;p&gt;👉 To &lt;em&gt;list&lt;/em&gt; media → use &lt;strong&gt;attachments&lt;/strong&gt; with &lt;code&gt;wp post&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;However, &lt;code&gt;wp media&lt;/code&gt; &lt;strong&gt;is still very useful&lt;/strong&gt; for managing media files.&lt;/p&gt;




&lt;h3&gt;
  
  
  Useful &lt;code&gt;wp media&lt;/code&gt; Subcommands
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fix image rotation&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  wp media fix-orientation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;When:&lt;/em&gt; Images look rotated after upload&lt;br&gt;
  &lt;em&gt;Why:&lt;/em&gt; Automatically fixes orientation metadata&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;See registered image sizes&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  wp media image-size
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;When:&lt;/em&gt; You want to know which image sizes WordPress uses&lt;br&gt;
  &lt;em&gt;Why:&lt;/em&gt; Helpful when working with themes or performance&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Import media files&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  wp media import image.jpg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;When:&lt;/em&gt; Uploading files in bulk or migrating content&lt;br&gt;
  &lt;em&gt;Why:&lt;/em&gt; Faster than uploading through the browser&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Regenerate thumbnails&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  wp media regenerate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;When:&lt;/em&gt; After changing image sizes or switching themes&lt;br&gt;
  &lt;em&gt;Why:&lt;/em&gt; Ensures images match the new settings&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Easy way to remember:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;List media → &lt;code&gt;wp post&lt;/code&gt; (attachments)&lt;br&gt;
Manage media → &lt;code&gt;wp media&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  13) Quick Search &amp;amp; Replace (Safe Way)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp search-replace &lt;span class="s1"&gt;'http://oldsite.com'&lt;/span&gt; &lt;span class="s1"&gt;'https://newsite.com'&lt;/span&gt; &lt;span class="nt"&gt;--dry-run&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
After moving a site or changing domains.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;
Safely updates links without breaking data.&lt;br&gt;
Always run with &lt;code&gt;--dry-run&lt;/code&gt; first.&lt;/p&gt;




&lt;h2&gt;
  
  
  14) Check WordPress Core Files
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp core verify-checksums
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
Something feels broken or suspicious.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;
Confirms WordPress core files are clean and unchanged.&lt;/p&gt;




&lt;h2&gt;
  
  
  15) Run a Small One-Time Check
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s1"&gt;'echo get_bloginfo("name");'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;br&gt;
You just want to check or tweak something quickly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;
Lets you use WordPress functions without editing files.&lt;/p&gt;




&lt;h2&gt;
  
  
  A Small Note on Custom Post Types
&lt;/h2&gt;

&lt;p&gt;I often use WP-CLI for Custom Post Types too, mainly to keep things fast and consistent. I’ll cover that workflow in a separate article.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;WP-CLI isn’t only for advanced developers.&lt;br&gt;
Even &lt;strong&gt;simple tasks&lt;/strong&gt;—updates, users, plugins, media—are easier once you get used to it.&lt;/p&gt;

&lt;p&gt;If you already know WordPress, WP-CLI is just another tool that makes daily work smoother and less annoying.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Please check this article &lt;a href="https://dev.to/muhammadmedhat/getting-started-with-wp-cli-a-powerful-tool-for-wordpress-developers-50ea" rel="noopener noreferrer"&gt;Getting Started with WP-CLI&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>beginners</category>
      <category>cli</category>
      <category>productivity</category>
      <category>wordpress</category>
    </item>
    <item>
      <title>The Classic WordPress Template Hierarchy — The Map Behind Every Theme</title>
      <dc:creator>Muhammad Medhat</dc:creator>
      <pubDate>Sun, 26 Oct 2025 12:32:34 +0000</pubDate>
      <link>https://dev.to/muhammadmedhat/the-classic-wordpress-template-hierarchy-the-map-behind-every-them-3pbj</link>
      <guid>https://dev.to/muhammadmedhat/the-classic-wordpress-template-hierarchy-the-map-behind-every-them-3pbj</guid>
      <description>&lt;h2&gt;
  
  
  The Classic WordPress Template Hierarchy — Explained Like a Map
&lt;/h2&gt;

&lt;p&gt;When you open a page on a WordPress site, you might think the system just “loads the right file.”&lt;br&gt;
But behind the scenes, something much more elegant happens — a logical treasure hunt called the &lt;strong&gt;Template Hierarchy&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This hierarchy is the backbone of every classic (PHP-based) WordPress theme. It determines which template file WordPress will use to display a certain type of content — from a blog post to a category archive, to that friendly (or not so friendly) &lt;em&gt;404&lt;/em&gt; page.&lt;/p&gt;

&lt;p&gt;Let’s take a walk through that map — step by step — and see how WordPress decides what to load.&lt;/p&gt;


&lt;h2&gt;
  
  
  What Is the Template Hierarchy?
&lt;/h2&gt;

&lt;p&gt;When a visitor requests a page, WordPress does three things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Queries the database&lt;/strong&gt; to determine what’s being requested (a post, a category, a page, etc.).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Builds a prioritized list&lt;/strong&gt; of possible template files based on that type of request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Loads the first template file that exists&lt;/strong&gt; in your active theme directory.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If nothing more specific is found, WordPress gracefully falls back to the ultimate safety net: &lt;code&gt;index.php&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Think of it as WordPress saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Do we have something specific for this? No? Okay, something more general? Still no? Alright then, use &lt;code&gt;index.php&lt;/code&gt; and show &lt;em&gt;something!&lt;/em&gt;”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That’s the beauty of the system — &lt;strong&gt;it never breaks&lt;/strong&gt;, it just gets simpler.&lt;/p&gt;


&lt;h2&gt;
  
  
  1. Front Page and Home
&lt;/h2&gt;

&lt;p&gt;Your homepage behavior depends on what you’ve set in &lt;strong&gt;Settings → Reading&lt;/strong&gt;:&lt;/p&gt;
&lt;h3&gt;
  
  
  If “Your latest posts” is selected:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;home.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;index.php&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  If “A static page” is selected:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;front-page.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;If a page is assigned as “Posts Page”: &lt;code&gt;home.php&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Fallback: &lt;code&gt;index.php&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In short:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;front-page.php&lt;/code&gt; → Always highest priority for the site front page.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;home.php&lt;/code&gt; → The blog posts listing.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;index.php&lt;/code&gt; → The safety net.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;📘 &lt;a href="https://developer.wordpress.org/themes/basics/template-hierarchy/#front-page-display" rel="noopener noreferrer"&gt;Reference – Front Page Display&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  2. Single Posts and Custom Post Types
&lt;/h2&gt;

&lt;p&gt;Whenever you open a single post, WordPress looks for templates in this order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;single-{post_type}-{slug}.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;single-{post_type}.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;single.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;singular.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;index.php&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example:&lt;br&gt;
If you have a custom post type called &lt;code&gt;movie&lt;/code&gt; and the post slug is &lt;code&gt;inception&lt;/code&gt;, WordPress will try:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;single-movie-inception.php
→ single-movie.php
→ single.php
→ singular.php
→ index.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📘 &lt;a href="https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post" rel="noopener noreferrer"&gt;Reference – Single Post Templates&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Pages (Static Pages)
&lt;/h2&gt;

&lt;p&gt;Pages have their own neat system because they can use &lt;strong&gt;custom templates&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Order of lookup:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Template selected in the Page Editor (&lt;code&gt;Template Name:&lt;/code&gt; in file header)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;page-{slug}.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;page-{id}.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;page.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;singular.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;index.php&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example: for a page titled &lt;strong&gt;About Us&lt;/strong&gt;, with slug &lt;code&gt;about&lt;/code&gt;, the chain might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;page-about.php
→ page-42.php
→ page.php
→ singular.php
→ index.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📘 &lt;a href="https://developer.wordpress.org/themes/basics/template-hierarchy/#page" rel="noopener noreferrer"&gt;Reference – Page Templates&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Archives: Categories, Tags, Custom Taxonomies
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Category Archive
&lt;/h3&gt;

&lt;p&gt;When browsing a category archive (like &lt;code&gt;/category/news&lt;/code&gt;):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;category-{slug}.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;category-{id}.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;category.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;archive.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;index.php&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Tag Archive
&lt;/h3&gt;

&lt;p&gt;For tags, it’s similar:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;tag-{slug}.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tag-{id}.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tag.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;archive.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;index.php&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Custom Taxonomies
&lt;/h3&gt;

&lt;p&gt;If you’ve registered a custom taxonomy (say &lt;code&gt;genre&lt;/code&gt; for books):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;taxonomy-{taxonomy}-{term}.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;taxonomy-{taxonomy}.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;taxonomy.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;archive.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;index.php&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;📘 &lt;a href="https://developer.wordpress.org/themes/basics/template-hierarchy/#custom-taxonomies" rel="noopener noreferrer"&gt;Reference – Category, Tag &amp;amp; Taxonomy Templates&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Author, Date, and Other Archives
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Author Archives
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;author-{nicename}.php
→ author-{id}.php
→ author.php
→ archive.php
→ index.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Date Archives
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;date.php
→ archive.php
→ index.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Other archives (post type archives, search results, etc.) follow a similar pattern.&lt;/p&gt;

&lt;p&gt;📘 &lt;a href="https://developer.wordpress.org/themes/basics/template-hierarchy/#author-and-date" rel="noopener noreferrer"&gt;Reference – Author and Date Archives&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Search and 404 Templates
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Search Results
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;search.php
→ index.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  404 (Not Found)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;404.php
→ index.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A well-designed &lt;code&gt;404.php&lt;/code&gt; can turn a dead-end into a friendly nudge — or even a chance to show helpful links or your site map.&lt;/p&gt;

&lt;p&gt;📘 &lt;a href="https://developer.wordpress.org/themes/basics/template-hierarchy/#special-templates" rel="noopener noreferrer"&gt;Reference – Special Templates&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Attachments and Comments
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Attachments (media items)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;attachment-{mime_type}.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;attachment.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;single-attachment.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;single.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;index.php&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Comments Template&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;comments.php&lt;/code&gt; is included inside your templates via &lt;code&gt;comments_template()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;📘 &lt;a href="https://developer.wordpress.org/themes/basics/template-hierarchy/#attachment" rel="noopener noreferrer"&gt;Reference – Attachments&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Child Themes and Overrides
&lt;/h2&gt;

&lt;p&gt;When using a &lt;strong&gt;child theme&lt;/strong&gt;, the lookup happens twice — once in the child, then in the parent:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;WordPress first checks the &lt;strong&gt;child theme&lt;/strong&gt; for the requested file.&lt;/li&gt;
&lt;li&gt;If it doesn’t exist there, it falls back to the &lt;strong&gt;parent theme&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/wp-content/themes/my-child-theme/single.php
→ /wp-content/themes/my-parent-theme/single.php
→ index.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s why child themes are the perfect way to modify templates safely — without breaking or overwriting parent theme updates.&lt;/p&gt;

&lt;p&gt;📘 &lt;a href="https://developer.wordpress.org/themes/advanced-topics/child-themes/" rel="noopener noreferrer"&gt;Reference – Child Themes&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Why This Hierarchy Is Brilliant
&lt;/h2&gt;

&lt;p&gt;The hierarchy makes WordPress:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Predictable&lt;/strong&gt; — You always know where to put your custom template.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexible&lt;/strong&gt; — You can override only what you need.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fail-safe&lt;/strong&gt; — It always falls back to &lt;code&gt;index.php&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Readable&lt;/strong&gt; — Anyone who understands the hierarchy can quickly read a theme’s structure.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s like a well-thought-out decision tree that keeps WordPress adaptable without chaos.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The WordPress Template Hierarchy is not just a technical system — it’s &lt;em&gt;design philosophy in code form&lt;/em&gt;.&lt;br&gt;
It rewards organization, clarity, and foresight. Once you understand it, you gain full control over how every pixel of your site is displayed.&lt;/p&gt;

&lt;p&gt;In the next article, we’ll explore how this hierarchy evolves in the &lt;strong&gt;Block Theme / Full Site Editing (FSE)&lt;/strong&gt; era — and what remains timeless.&lt;/p&gt;




&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.wordpress.org/themes/basics/template-hierarchy/" rel="noopener noreferrer"&gt;Template Hierarchy – WordPress Developer Resources&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://digwp.com/2010/09/wordpress-3-template-hierarchy/" rel="noopener noreferrer"&gt;DigWP – WordPress 3 Template Hierarchy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://wpshout.com/wordpress-template-hierarchy/" rel="noopener noreferrer"&gt;WPShout – WordPress Template Hierarchy Explained&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kinsta.com/blog/wordpress-template-hierarchy/" rel="noopener noreferrer"&gt;Kinsta – WordPress Template Hierarchy Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.wordpress.org/themes/advanced-topics/child-themes/" rel="noopener noreferrer"&gt;WordPress Codex – Child Themes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>wordpress</category>
      <category>php</category>
    </item>
    <item>
      <title>Common WordPress Mistakes New Developers Make and How to Avoid Them</title>
      <dc:creator>Muhammad Medhat</dc:creator>
      <pubDate>Fri, 22 Aug 2025 14:47:12 +0000</pubDate>
      <link>https://dev.to/muhammadmedhat/common-wordpress-mistakes-new-developers-make-and-how-to-avoid-them-19ci</link>
      <guid>https://dev.to/muhammadmedhat/common-wordpress-mistakes-new-developers-make-and-how-to-avoid-them-19ci</guid>
      <description>&lt;p&gt;WordPress is one of the most popular content management systems in the world, powering over 40% of websites. While it’s beginner-friendly, new developers often make mistakes that can cause performance issues, security vulnerabilities, or maintenance headaches down the road.&lt;/p&gt;

&lt;p&gt;In this article, we’ll cover the most common mistakes beginners make in WordPress development — and how you can avoid them to build faster, safer, and more maintainable websites.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Ignoring WordPress Coding Standards
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The mistake:&lt;/strong&gt; Writing PHP, HTML, CSS, or JavaScript without following WordPress coding standards.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Makes your code hard to read and maintain.&lt;/li&gt;
&lt;li&gt;Other developers may struggle to understand your work.&lt;/li&gt;
&lt;li&gt;Increases the risk of errors and bugs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to fix:&lt;/strong&gt;&lt;br&gt;
Follow the official &lt;a href="https://developer.wordpress.org/coding-standards/" rel="noopener noreferrer"&gt;WordPress Coding Standards&lt;/a&gt;. You can also integrate tools like &lt;strong&gt;PHPCS&lt;/strong&gt; into your development workflow to automatically enforce them.&lt;/p&gt;


&lt;h2&gt;
  
  
  2. Not Using Version Control (like Git)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The mistake:&lt;/strong&gt; Building entire websites without Git or any version control system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No backup of your changes.&lt;/li&gt;
&lt;li&gt;Difficult to collaborate with a team.&lt;/li&gt;
&lt;li&gt;Impossible to roll back safely if something breaks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to fix:&lt;/strong&gt;&lt;br&gt;
Learn Git basics and use platforms like GitHub, GitLab, or Bitbucket. Even if you’re working alone, version control will save you from countless headaches.&lt;/p&gt;


&lt;h2&gt;
  
  
  3. Hardcoding URLs and File Paths
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The mistake:&lt;/strong&gt; Writing URLs directly into your templates or functions (e.g., &lt;code&gt;https://example.com/images/logo.png&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Moving the site to another domain or staging environment becomes painful.&lt;/li&gt;
&lt;li&gt;Breaks your site during migrations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to fix:&lt;/strong&gt;&lt;br&gt;
Always use WordPress functions like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nf"&gt;get_template_directory_uri&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nf"&gt;home_url&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These functions keep your site flexible and migration-friendly.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Ignoring Security Best Practices
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The mistake:&lt;/strong&gt; Leaving the default “admin” username, weak passwords, or not updating plugins.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WordPress sites are common targets for hackers.&lt;/li&gt;
&lt;li&gt;Weak security can lead to malware, spam, or data theft.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Always change the default admin username.&lt;/li&gt;
&lt;li&gt;Use strong passwords and two-factor authentication.&lt;/li&gt;
&lt;li&gt;Keep themes, plugins, and WordPress core updated.&lt;/li&gt;
&lt;li&gt;Use a reputable security plugin like Wordfence or Sucuri.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. Forgetting to Optimize Performance
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The mistake:&lt;/strong&gt; Installing too many plugins, uploading uncompressed images, and ignoring caching.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Slow websites drive visitors away.&lt;/li&gt;
&lt;li&gt;Poor performance affects SEO rankings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Minimize plugin usage — only keep what’s necessary.&lt;/li&gt;
&lt;li&gt;Compress images using tools like TinyPNG or plugins like Smush.&lt;/li&gt;
&lt;li&gt;Use caching plugins such as WP Rocket or LiteSpeed Cache.&lt;/li&gt;
&lt;li&gt;Implement a CDN (Content Delivery Network) if possible.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  6. Editing Core WordPress Files
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The mistake:&lt;/strong&gt; Modifying WordPress core files to change functionality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your changes will be wiped out on updates.&lt;/li&gt;
&lt;li&gt;Can break the site or introduce security holes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to fix:&lt;/strong&gt;&lt;br&gt;
Never edit WordPress core files. If you need to extend or modify functionality, use hooks (actions and filters) or custom plugins.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Poor Database Management
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The mistake:&lt;/strong&gt; Not cleaning up unused tables, revisions, or testing queries directly in the live database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Leads to bloated databases and slow queries.&lt;/li&gt;
&lt;li&gt;Increases chances of breaking the site.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Regularly optimize your database using plugins like WP-Optimize.&lt;/li&gt;
&lt;li&gt;Always back up your database before making changes.&lt;/li&gt;
&lt;li&gt;For testing queries, use a local environment or staging site, not production.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  8. Not Using a Child Theme
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The mistake:&lt;/strong&gt; Editing a parent theme’s files directly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All changes will be lost once the theme is updated.&lt;/li&gt;
&lt;li&gt;Maintaining and debugging becomes very difficult.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to fix:&lt;/strong&gt;&lt;br&gt;
Always create a &lt;strong&gt;child theme&lt;/strong&gt; before making modifications. This way, you can safely update the parent theme while keeping your customizations intact. Here’s &lt;a href="https://developer.wordpress.org/themes/advanced-topics/child-themes/" rel="noopener noreferrer"&gt;WordPress’s guide on child themes&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Skipping Regular Backups
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The mistake:&lt;/strong&gt; Relying on “hoping nothing breaks” instead of real backups.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sites can break during updates.&lt;/li&gt;
&lt;li&gt;Hosting problems, hacks, or human mistakes can cause data loss.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to fix:&lt;/strong&gt;&lt;br&gt;
Always schedule automatic backups. Use plugins like UpdraftPlus or rely on your hosting provider’s built-in backup solutions.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Advice: Choose Managed Hosting
&lt;/h2&gt;

&lt;p&gt;One of the smartest moves for new developers is to use &lt;strong&gt;WordPress managed hosting&lt;/strong&gt;. With managed hosting, you get built-in performance optimization, advanced security, and automatic backups.&lt;/p&gt;

&lt;p&gt;Most providers also offer &lt;strong&gt;their own caching and backup plugins&lt;/strong&gt;, which are usually better integrated and more reliable than third-party options. By using them, you avoid plugin conflicts and ensure your site stays secure and fast.&lt;/p&gt;




&lt;p&gt;✅ By avoiding these mistakes, using child themes, and relying on managed hosting with built-in tools, you’ll save yourself countless hours of troubleshooting — and ensure your WordPress projects are professional, scalable, and easy to maintain.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>wordpress</category>
      <category>programming</category>
      <category>seo</category>
    </item>
    <item>
      <title>How to Do AJAX in WordPress Correctly: A Complete Guide with jQuery and Vanilla JavaScript</title>
      <dc:creator>Muhammad Medhat</dc:creator>
      <pubDate>Fri, 08 Aug 2025 12:54:17 +0000</pubDate>
      <link>https://dev.to/muhammadmedhat/how-to-do-ajax-in-wordpress-correctly-a-complete-guide-with-jquery-and-vanilla-javascript-7j0</link>
      <guid>https://dev.to/muhammadmedhat/how-to-do-ajax-in-wordpress-correctly-a-complete-guide-with-jquery-and-vanilla-javascript-7j0</guid>
      <description>&lt;h2&gt;
  
  
  How to Do AJAX in WordPress Correctly
&lt;/h2&gt;

&lt;p&gt;AJAX (Asynchronous JavaScript and XML) is a technique for making background HTTP requests to the server without reloading the page. In WordPress, AJAX is often used to load data dynamically, process forms, or update content in real time. WordPress has a built-in AJAX handling system via &lt;code&gt;admin-ajax.php&lt;/code&gt; that works both in the admin and the front-end — when set up correctly.&lt;/p&gt;

&lt;p&gt;In this article, we’ll cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The basic flow of AJAX in WordPress.&lt;/li&gt;
&lt;li&gt;Two approaches — &lt;strong&gt;jQuery&lt;/strong&gt; and &lt;strong&gt;Vanilla JavaScript&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;How to properly pass variables from PHP to JavaScript.&lt;/li&gt;
&lt;li&gt;A quick comparison of both approaches.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. How WordPress AJAX Works
&lt;/h2&gt;

&lt;p&gt;A standard WordPress AJAX request involves:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;JavaScript event&lt;/strong&gt; triggers a request.&lt;/li&gt;
&lt;li&gt;The request is sent to &lt;code&gt;admin-ajax.php&lt;/code&gt; with an &lt;code&gt;action&lt;/code&gt; parameter.&lt;/li&gt;
&lt;li&gt;WordPress executes the matching PHP function via &lt;code&gt;add_action()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The PHP function returns a response.&lt;/li&gt;
&lt;li&gt;JavaScript receives the response and updates the DOM.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Official docs: [WordPress AJAX documentation][1].&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Enqueueing Scripts and Localizing Variables
&lt;/h2&gt;

&lt;p&gt;Whether you use jQuery or Vanilla JS, you first need to enqueue your script in &lt;code&gt;functions.php&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;my_enqueue_scripts&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;wp_enqueue_script&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s1"&gt;'my-ajax-script'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nf"&gt;get_template_directory_uri&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="s1"&gt;'/js/my-ajax.js'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'jquery'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;// remove 'jquery' if using vanilla JS only&lt;/span&gt;
        &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="nf"&gt;wp_localize_script&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'my-ajax-script'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'ajax_object'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'ajax_url'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;admin_url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'admin-ajax.php'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'wp_enqueue_scripts'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'my_enqueue_scripts'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This &lt;code&gt;wp_localize_script()&lt;/code&gt; call makes &lt;code&gt;ajax_object.ajax_url&lt;/code&gt; available in your JavaScript file.&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;💡 Note on &lt;code&gt;ajaxurl&lt;/code&gt; vs &lt;code&gt;ajax_object.ajax_url&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
In the WordPress &lt;strong&gt;admin area&lt;/strong&gt;, there is already a global JavaScript variable called &lt;code&gt;ajaxurl&lt;/code&gt; that points to the AJAX handler:&lt;/p&gt;


&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ajaxurl&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// https://yoursite.com/wp-admin/admin-ajax.php&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;This variable is &lt;strong&gt;only available in the admin&lt;/strong&gt; by default.&lt;br&gt;
On the &lt;strong&gt;front-end&lt;/strong&gt;, &lt;code&gt;ajaxurl&lt;/code&gt; is &lt;strong&gt;not automatically defined&lt;/strong&gt;, so you must pass it yourself.&lt;br&gt;
The standard way to do this is by using &lt;code&gt;wp_localize_script()&lt;/code&gt; in PHP:&lt;/p&gt;


&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;wp_localize_script&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'my-ajax-script'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'ajax_object'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'ajax_url'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;admin_url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'admin-ajax.php'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;This creates a global object in JavaScript:&lt;/p&gt;


&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;ajax_object&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;ajax_url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://yoursite.com/wp-admin/admin-ajax.php&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;strong&gt;Summary:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Admin pages&lt;/strong&gt; → You can use &lt;code&gt;ajaxurl&lt;/code&gt; directly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Front-end pages&lt;/strong&gt; → Use a localized variable like &lt;code&gt;ajax_object.ajax_url&lt;/code&gt;.
Both point to the same endpoint, but their availability depends on context.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  3. PHP AJAX Handler
&lt;/h2&gt;

&lt;p&gt;Create the PHP function that will process the request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;my_ajax_handler&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sanitize_text_field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'name'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
    &lt;span class="nf"&gt;wp_send_json_success&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Hello, &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;!"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'wp_ajax_my_action'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'my_ajax_handler'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'wp_ajax_nopriv_my_action'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'my_ajax_handler'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;wp_ajax_my_action&lt;/code&gt; → for logged-in users.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;wp_ajax_nopriv_my_action&lt;/code&gt; → for visitors not logged in.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. jQuery AJAX Example
&lt;/h2&gt;

&lt;p&gt;If your theme already includes jQuery, AJAX calls are quick to set up:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;jQuery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;ready&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#myButton&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ajax&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
            &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ajax_object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ajax_url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;my_action&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#nameInput&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;val&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="p"&gt;},&lt;/span&gt;
            &lt;span class="na"&gt;success&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt; Short syntax, good browser support, minimal setup if jQuery is present.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Vanilla JavaScript (Fetch API) Example
&lt;/h2&gt;

&lt;p&gt;For modern projects, you can skip jQuery entirely and use the native &lt;code&gt;fetch()&lt;/code&gt; API [2]:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;myButton&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nameInput&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ajax_object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ajax_url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/x-www-form-urlencoded&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;URLSearchParams&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
            &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;my_action&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;
        &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt; No dependency on jQuery, smaller page size, modern syntax.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Comparison: jQuery vs Vanilla JavaScript
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature / Factor&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;jQuery Method&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Vanilla JS Method&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ease of Use&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Very easy if jQuery is already loaded; simple syntax&lt;/td&gt;
&lt;td&gt;Slightly more verbose; modern syntax but requires understanding of &lt;code&gt;fetch()&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Dependencies&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Requires jQuery library (~90KB minified)&lt;/td&gt;
&lt;td&gt;No dependencies — built into modern browsers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Browser Support&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Excellent, including older browsers (IE9+)&lt;/td&gt;
&lt;td&gt;Modern browsers only (IE not supported without polyfill)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Learning Curve&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Low, especially for developers familiar with WordPress&lt;/td&gt;
&lt;td&gt;Moderate — requires ES6+ knowledge&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Performance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Slightly slower load times due to jQuery overhead&lt;/td&gt;
&lt;td&gt;Faster initial load (no extra library)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Best For&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Legacy projects, themes already using jQuery&lt;/td&gt;
&lt;td&gt;Modern, lightweight projects; performance-focused builds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;$.ajax({...})&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fetch(url, {...})&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  7. Conclusion
&lt;/h2&gt;

&lt;p&gt;If your theme or plugin &lt;strong&gt;already uses jQuery&lt;/strong&gt;, the jQuery method is fast to implement and compatible with older browsers.&lt;br&gt;
For &lt;strong&gt;new, performance-focused builds&lt;/strong&gt;, vanilla JavaScript with &lt;code&gt;fetch()&lt;/code&gt; is the better choice — no extra library required, cleaner dependencies, and a future-proof approach.&lt;/p&gt;




&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;WordPress Developer Resources. AJAX in Plugins. Available from: &lt;a href="https://developer.wordpress.org/plugins/javascript/ajax/" rel="noopener noreferrer"&gt;https://developer.wordpress.org/plugins/javascript/ajax/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Mozilla Developer Network. Fetch API. Available from: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Mozilla Developer Network. URLSearchParams. Available from: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>wordpress</category>
      <category>javascript</category>
      <category>jquery</category>
      <category>webdev</category>
    </item>
    <item>
      <title>⚡ Automating Repetitive Tasks Using VS Code Snippets</title>
      <dc:creator>Muhammad Medhat</dc:creator>
      <pubDate>Mon, 04 Aug 2025 13:33:04 +0000</pubDate>
      <link>https://dev.to/muhammadmedhat/automating-repetitive-tasks-using-vs-code-snippets-100p</link>
      <guid>https://dev.to/muhammadmedhat/automating-repetitive-tasks-using-vs-code-snippets-100p</guid>
      <description>&lt;p&gt;As developers, we write the same chunks of code again and again — whether it’s a React component, a PHP function, a JavaScript utility, or a WordPress loop. This repetition isn’t just tedious, it slows us down and increases the risk of human error.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VS Code snippets&lt;/strong&gt; offer a powerful way to automate your repetitive tasks, allowing you to generate entire blocks of boilerplate code with just a few keystrokes.&lt;/p&gt;

&lt;p&gt;In this article, you’ll learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What VS Code snippets are&lt;/li&gt;
&lt;li&gt;How to create your own snippets&lt;/li&gt;
&lt;li&gt;Useful snippet extensions&lt;/li&gt;
&lt;li&gt;Real-world snippet examples for PHP, JS, and WordPress&lt;/li&gt;
&lt;li&gt;Tips to improve your productivity using snippets&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧠 What Are VS Code Snippets?
&lt;/h2&gt;

&lt;p&gt;Snippets in Visual Studio Code are &lt;strong&gt;templates&lt;/strong&gt; that make it easier to enter repeating code patterns. When triggered, they auto-complete predefined blocks of code, allowing you to write less and do more.&lt;/p&gt;

&lt;p&gt;They can include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Placeholders (&lt;code&gt;$1&lt;/code&gt;, &lt;code&gt;$2&lt;/code&gt;, etc.)&lt;/li&gt;
&lt;li&gt;Variables (like &lt;code&gt;$TM_FILENAME&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Dynamic behavior (like cursor positioning or repetition)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ⚙️ How to Create a Snippet in VS Code
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open the Command Palette: &lt;code&gt;Ctrl+Shift+P&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Choose: &lt;code&gt;Preferences: Configure User Snippets&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Select or create a language-specific or global snippet file&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A sample PHP function snippet might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"Simple PHP Function"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"prefix"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"phpfn"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"function ${1:functionName}(${2:$arg}) {"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"    $3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"}"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Basic PHP function"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, typing &lt;code&gt;phpfn&lt;/code&gt; and pressing &lt;code&gt;Tab&lt;/code&gt; will generate a complete PHP function.&lt;/p&gt;




&lt;h2&gt;
  
  
  📦 Popular VS Code Snippet Extensions
&lt;/h2&gt;

&lt;p&gt;While writing custom snippets is great, sometimes you just want prebuilt ones. Here are some amazing snippet packs from the marketplace:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🔹 &lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets" rel="noopener noreferrer"&gt;ES7+ React/Redux/React-Native snippets&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;🔹 &lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=xabikos.JavaScriptSnippets" rel="noopener noreferrer"&gt;JavaScript (ES6) Code Snippets&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;🔹 &lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=burkeholland.simple-react-snippets" rel="noopener noreferrer"&gt;Simple React Snippets&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;🔹 &lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=donjayamanne.jquerysnippets" rel="noopener noreferrer"&gt;jQuery Code Snippets&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;🔹 &lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=onecentlin.laravel-blade" rel="noopener noreferrer"&gt;Laravel Blade Snippets&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;🔹 &lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=sabasprince.wordpress-snippets" rel="noopener noreferrer"&gt;WordPress Snippets&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can find more on the &lt;a href="https://marketplace.visualstudio.com/vscode" rel="noopener noreferrer"&gt;VS Code Marketplace&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔥 Real-World Snippet Examples
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🟦 WordPress Loop Snippet
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"WordPress Loop"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"prefix"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"wploop"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"if ( have_posts() ) :"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"  while ( have_posts() ) : the_post();"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"    ?&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"    &amp;lt;article id=&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;post-&amp;lt;?php the_ID(); ?&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt; &amp;lt;?php post_class(); ?&amp;gt;&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"      &amp;lt;h2&amp;gt;&amp;lt;a href=&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;?php the_permalink(); ?&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;&amp;gt;&amp;lt;?php the_title(); ?&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"      &amp;lt;div class=&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;entry-content&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"        &amp;lt;?php the_excerpt(); ?&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"      &amp;lt;/div&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"    &amp;lt;/article&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"    &amp;lt;?php"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"  endwhile;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"  the_posts_pagination();"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"else :"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"  echo '&amp;lt;p&amp;gt;No posts found.&amp;lt;/p&amp;gt;';"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"endif;"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"WordPress default loop with pagination"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  🟨 JavaScript – Debounce Function
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"Debounce Function"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"prefix"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"debounce"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"function debounce(fn, delay) {"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"  let timeout;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"  return function(...args) {"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"    clearTimeout(timeout);"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"    timeout = setTimeout(() =&amp;gt; fn.apply(this, args), delay);"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"  };"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"}"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Debounce a function to limit calls"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  🟪 PHP – Custom Post Type in WordPress
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"Register CPT"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"prefix"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"regcpt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"function ${1:register_book_post_type}() {"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"  register_post_type( '${2:book}', array("&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"    'labels' =&amp;gt; array("&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"      'name' =&amp;gt; __( '${3:Books}' ),"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"      'singular_name' =&amp;gt; __( '${4:Book}' )"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"    ),"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"    'public' =&amp;gt; true,"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"    'rewrite' =&amp;gt; array( 'slug' =&amp;gt; '${5:books}' ),"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"    'show_in_rest' =&amp;gt; true,"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"    'supports' =&amp;gt; array( 'title', 'editor', 'thumbnail' )"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"  ));"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"add_action( 'init', '${1:register_book_post_type}' );"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Register a custom post type"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  💡 Tips for Power Users
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;$TM_FILENAME_BASE&lt;/code&gt; to insert the current file’s name&lt;/li&gt;
&lt;li&gt;Store common snippets in &lt;strong&gt;global snippets file&lt;/strong&gt; (&lt;code&gt;global.code-snippets&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Export/import your snippets using &lt;strong&gt;Settings Sync&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Assign custom &lt;strong&gt;prefixes&lt;/strong&gt; for each stack you work on: &lt;code&gt;wp_&lt;/code&gt;, &lt;code&gt;js_&lt;/code&gt;, &lt;code&gt;php_&lt;/code&gt;, etc.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🎯 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Using snippets in VS Code is one of the simplest yet most powerful ways to &lt;strong&gt;increase productivity&lt;/strong&gt;, &lt;strong&gt;reduce errors&lt;/strong&gt;, and &lt;strong&gt;standardize your code&lt;/strong&gt;. Whether you're writing complex WordPress plugins, modern JavaScript apps, or backend PHP logic — snippets can save you hours every week.&lt;/p&gt;

&lt;p&gt;So stop writing the same thing over and over. Automate it!&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>vscode</category>
      <category>wordpress</category>
      <category>php</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
