{"id":5331,"date":"2026-04-01T21:43:36","date_gmt":"2026-04-01T20:43:36","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=5331"},"modified":"2026-04-01T21:47:48","modified_gmt":"2026-04-01T20:47:48","slug":"options-api-useful-examples","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/wordpress\/database\/built-in-db-functions\/options-api-useful-examples","title":{"rendered":"Options API Useful Examples"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Do something if it hasn&#8217;t been done in # time<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>  \/\/----- DO AUTO DELETE IF NECESSARY -----\n  $SecondsAgo = (365 * 24 * 60 * 60);\n  if ($MyOptionSettingName = get_option('MyOptionSettingName'))\n    $SecondsAgo = strtotime(gmdate(\"Y-m-d H:i:s\")) - strtotime($MyOptionSettingName);\n  if ($SecondsAgo > (1 * 24 * 60 * 60))   \/\/&lt;&lt;&lt;&lt;Set how often to do this\n  {\n    update_option('MyOptionSettingName', gmdate('Y-m-d H:i:s'), True);    \/\/Update time stamp of last done\n\n    \/\/&lt;&lt;&lt;Do it here\n\n  }<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Do something if it hasn&#8217;t been done in # time<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[296,353],"tags":[],"class_list":["post-5331","post","type-post","status-publish","format-standard","hentry","category-built-in-db-functions","category-settongs"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/5331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=5331"}],"version-history":[{"count":2,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/5331\/revisions"}],"predecessor-version":[{"id":5335,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/5331\/revisions\/5335"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=5331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=5331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=5331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}