{"id":785,"date":"2008-04-11T23:18:34","date_gmt":"2008-04-11T21:18:34","guid":{"rendered":"http:\/\/planetozh.com\/blog\/?p=785"},"modified":"2008-04-11T23:18:34","modified_gmt":"2008-04-11T21:18:34","slug":"4-checkpoints-to-make-sure-plugin-update-notices-in-wordpress-will-work","status":"publish","type":"post","link":"https:\/\/planetozh.com\/blog\/2008\/04\/4-checkpoints-to-make-sure-plugin-update-notices-in-wordpress-will-work\/","title":{"rendered":"4 Checkpoints to Make Sure Plugin Update Notices in WordPress Will Work"},"content":{"rendered":"<p>One of the mostest ubercoolest feature in WordPress is its ability to warn you about an outdated plugin you might be running on your blog, so you can upgrade in a snap and as soon as a new version gets off the press (assuming this plugin is hosted on <a href=\"http:\/\/wordpress.org\/extend\/plugins\/\">wp.org\/plugins<\/a>)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"580\" height=\"122\" src=\"http:\/\/planetozh.com\/blog\/wp-content\/uploads\/2008\/04\/update-plugin.jpg\" alt=\"\" title=\"update-plugin\" class=\"aligncenter size-full wp-image-786\" srcset=\"https:\/\/planetozh.com\/blog\/wp-content\/uploads\/2008\/04\/update-plugin.jpg 580w, https:\/\/planetozh.com\/blog\/wp-content\/uploads\/2008\/04\/update-plugin-300x63.jpg 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/p>\n<p>The thing is: it&#39;s cool&#8230; when it works. After updating my own plugins recently to make them WordPress 2.5 friendly, I noticed that my &quot;Manage Plugins&quot; page was not warning me about new versions. Me. Their very genitor. What a shame. After a bit of testing and abusing the API server from wordpress.org, I realized that there are a few innocent things you can do, both as a plugin coder and a user, that will prevent the update system from working as intended.<\/p>\n<p>I found <strong>four checkpoints<\/strong> to make sure everything will work as expected:<br \/>\n<!--more Read more to learn to count to four, and for a tool to help!--><\/p>\n<h2>Consistency is the word<\/h2>\n<p>OK, &quot;Consistency is the last refuge of the unimaginative&quot; (Oscar Wilde) but we&#39;re talking about making things work here. So, let&#39;s try to be unimaginative :) The key is to ensure consistency between the following 4 properties:<\/p>\n<ol>\n<li>the plugin&#39;s name in its readme.txt<\/li>\n<li>the plugin&#39;s name in the PHP plugin header<\/li>\n<li>the plugin&#39;s directory name in the <a href=\"http:\/\/wordpress.org\/extend\/plugins\/\">repository<\/a><\/li>\n<li>the plugin&#39;s directory name on your own server, within <em>wp-content\/plugins\/<\/em>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"561\" height=\"242\" src=\"http:\/\/planetozh.com\/blog\/wp-content\/uploads\/2008\/04\/4keys-to-update-plugin.gif\" alt=\"\" title=\"4keys-to-update-plugin\" class=\"aligncenter size-full wp-image-788\" srcset=\"https:\/\/planetozh.com\/blog\/wp-content\/uploads\/2008\/04\/4keys-to-update-plugin.gif 561w, https:\/\/planetozh.com\/blog\/wp-content\/uploads\/2008\/04\/4keys-to-update-plugin-300x129.gif 300w\" sizes=\"auto, (max-width: 561px) 100vw, 561px\" \/><\/p>\n<p>Let&#39;s say for example you have been approved for a plugin named &quot;Joe&#39;s Super Stuff&quot; which will be located at <em>http:\/\/wordpress.org\/extend\/plugins\/joe-super-stuff\/<\/em>. From what my tests have taught me, the plugin updater will fail upon one (or more) of the following:<\/p>\n<ul>\n<li>Plugin name in readme.txt is not &quot;Joe Super Stuff&quot;<\/li>\n<li>Plugin name in PHP file is not &quot;Joe Super Stuff&quot;<\/li>\n<li>User does not install plugin in wp-content\/plugins\/joe-super-stuff\/<\/li>\n<\/ul>\n<p>For instance, if plugin name is set to &quot;Joe&#39;s Super Stuff&quot; (extra <em>&#39;s<\/em>) or located in directory &quot;<em>super-stuff<\/em>&quot;, the plugin update system won&#39;t relate the installed plugin with the one on the central repository.<\/p>\n<h2>Troubleshooting your own installation<\/h2>\n<p>I&#39;ve your suspicious about a plugin that does not mention the existence of an update when you think there should be one, I&#39;ve set up a quick &quot;validator&quot; tool: the <a href=\"http:\/\/planetozh.com\/projects\/wordpress-plugin-update-check\/\">WordPress Plugin Update Check<\/a>.<\/p>\n<p><a href=\"http:\/\/planetozh.com\/projects\/wordpress-plugin-update-check\/\"><img loading=\"lazy\" decoding=\"async\" width=\"342\" height=\"182\" src=\"http:\/\/planetozh.com\/blog\/wp-content\/uploads\/2008\/04\/check-plugin-update.jpg\" alt=\"\" title=\"check-plugin-update\" class=\"alignleft size-full wp-image-789\" srcset=\"https:\/\/planetozh.com\/blog\/wp-content\/uploads\/2008\/04\/check-plugin-update.jpg 342w, https:\/\/planetozh.com\/blog\/wp-content\/uploads\/2008\/04\/check-plugin-update-300x159.jpg 300w\" sizes=\"auto, (max-width: 342px) 100vw, 342px\" \/><\/a> Enter in the form the plugin name as it appears in both the readme.txt and the PHP file. If everything goes yay, the script fetches the latest info about this plugin, which are its version number of course but also its &quot;slug&quot;, ie the directory it lives in. If something goes moo, that means at least one of the 4 checkpoints about consistency as I describe above has not been passed: directory installation (user&#39;s fault), or name in readme and\/or PHP file (coder&#39;s fault).<\/p>\n<p>Got a plugin that never tells you about an update ? Happy hunting! :)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the mostest ubercoolest feature in WordPress is its ability to warn you about an outdated plugin you might be running on your blog, so you can upgrade in a snap and as soon as a new version gets off the press (assuming this plugin is hosted on wp.org\/plugins) The thing is: it&#39;s cool&#8230; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[85,295,296,245],"class_list":["post-785","post","type-post","status-publish","format-standard","hentry","category-published","tag-plugins","tag-update","tag-validator","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/785","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=785"}],"version-history":[{"count":0,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/785\/revisions"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=785"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/categories?post=785"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/tags?post=785"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}