<?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: musk albert</title>
    <description>The latest articles on DEV Community by musk albert (@musk_albert_0965f32084408).</description>
    <link>https://dev.to/musk_albert_0965f32084408</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%2F4265262%2Fa47482aa-7617-4f9a-9682-8d30fefb24cd.png</url>
      <title>DEV Community: musk albert</title>
      <link>https://dev.to/musk_albert_0965f32084408</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/musk_albert_0965f32084408"/>
    <language>en</language>
    <item>
      <title>Three WordPress bugs I hit while building a 200-tool AI directory (and how I fixed them)</title>
      <dc:creator>musk albert</dc:creator>
      <pubDate>Wed, 25 Nov 2026 17:28:22 +0000</pubDate>
      <link>https://dev.to/musk_albert_0965f32084408/three-wordpress-bugs-i-hit-while-building-a-200-tool-ai-directory-and-how-i-fixed-them-59ck</link>
      <guid>https://dev.to/musk_albert_0965f32084408/three-wordpress-bugs-i-hit-while-building-a-200-tool-ai-directory-and-how-i-fixed-them-59ck</guid>
      <description>&lt;p&gt;I'm building &lt;a href="https://aibotradar.com" rel="noopener noreferrer"&gt;AIBotRadar&lt;/a&gt;, a free directory of AI tools with comparison guides and daily news. It runs on WordPress with custom post types: &lt;code&gt;ai_tool&lt;/code&gt;, &lt;code&gt;ai_guide&lt;/code&gt; and &lt;code&gt;ai_news&lt;/code&gt;. Most of the work is content, but three bugs cost me real time. Here they are, in case you hit them too.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Scheduled posts published immediately
&lt;/h2&gt;

&lt;p&gt;I wanted 12 guides to go live two hours apart, so I set &lt;code&gt;post_status&lt;/code&gt; to &lt;code&gt;future&lt;/code&gt; and a future &lt;code&gt;post_date&lt;/code&gt; through WP-CLI. They went live right away.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; WordPress also looks at &lt;code&gt;post_date_gmt&lt;/code&gt;. I only set the local date, and the GMT column stayed at &lt;code&gt;0000-00-00&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; set both columns, and convert the time zone yourself:&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;wp_update_post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s1"&gt;'ID'&lt;/span&gt;            &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'post_status'&lt;/span&gt;   &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'future'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'post_date'&lt;/span&gt;     &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$local&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   &lt;span class="c1"&gt;// site time zone&lt;/span&gt;
    &lt;span class="s1"&gt;'post_date_gmt'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$gmt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;// UTC&lt;/span&gt;
    &lt;span class="s1"&gt;'edit_date'&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="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;After that, check that &lt;code&gt;wp_next_scheduled( 'publish_future_post', array( $id ) )&lt;/code&gt; returns a timestamp. If it returns false, nothing will fire. A system cron that runs &lt;code&gt;wp cron event run --due-now&lt;/code&gt; every five minutes also makes the timing predictable.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The table of contents did nothing when clicked
&lt;/h2&gt;

&lt;p&gt;The guide pages have a floating table of contents. Clicking it did nothing. Two causes, both mine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The script that opens the contents panel was never enqueued on the live site. It existed in the theme folder, so it worked on my local copy.&lt;/li&gt;
&lt;li&gt;A site-wide output filter added &lt;code&gt;target="_blank"&lt;/code&gt; to every link, including &lt;code&gt;#section&lt;/code&gt; anchors, so each click tried to open a new tab instead of scrolling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The filter now skips links whose &lt;code&gt;href&lt;/code&gt; starts with &lt;code&gt;#&lt;/code&gt;. I also added a small re-align step: lazy-loaded images above a heading push it down while the page is still scrolling, so after the jump I re-check the heading's position a few times.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Search engines learned about new pages slowly
&lt;/h2&gt;

&lt;p&gt;Waiting for a crawler to find new pages is slow, so I added a small must-use plugin that pings IndexNow whenever a tool, guide or news post is published or updated. It hooks &lt;code&gt;transition_post_status&lt;/code&gt; and sends the URL list on &lt;code&gt;shutdown&lt;/code&gt;, so it doesn't slow the request. It also gave me an easy way to submit the whole sitemap once.&lt;/p&gt;

&lt;p&gt;Two things to know. The key file must be served byte for byte, so a trailing newline from a script on Windows made the first verification fail with a 403. And IndexNow is not read by Google, so it helps Bing and some other engines, not everything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it stands
&lt;/h2&gt;

&lt;p&gt;204 tools, 32 categories, 66 guides and 96 news stories. In Search Console I'm at roughly 3,200 impressions and 12 clicks, with most pages sitting on page 2. I'm focusing on comparison and "alternatives" guides now, since those seem more reachable than single-tool pages.&lt;/p&gt;

&lt;p&gt;If you have run a content site on WordPress, I'd like to hear what got your pages from page 2 to page 1.&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>webdev</category>
      <category>seo</category>
      <category>php</category>
    </item>
  </channel>
</rss>
