{"id":231393,"date":"2022-12-27T11:57:00","date_gmt":"2022-12-27T08:57:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=231393"},"modified":"2022-12-25T22:34:54","modified_gmt":"2022-12-25T19:34:54","slug":"zapiti-do-bazi-danih-dlja-shvidkogo-onovlennja-danih-chastina-1","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/uk\/zapiti-do-bazi-danih-dlja-shvidkogo-onovlennja-danih-chastina-1\/","title":{"rendered":"\u0417\u0430\u043f\u0438\u0442\u0438 \u0434\u043e \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u0434\u043b\u044f \u0448\u0432\u0438\u0434\u043a\u043e\u0433\u043e \u043e\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u0434\u0430\u043d\u0438\u0445, \u0447\u0430\u0441\u0442\u0438\u043d\u0430 1"},"content":{"rendered":"\n<p>\u0426\u0435 \u043d\u0435 \u043f\u0435\u0440\u0448\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u043b\u0438 \u044f \u0437\u0433\u0430\u0434\u0443\u044e \u043f\u0440\u043e \u0446\u0435, \u0430\u043b\u0435 \u043e\u0434\u043d\u0430 \u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043f\u043e\u0432&#8217;\u044f\u0437\u0430\u043d\u0438\u0445 \u0456\u0437 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044f\u043c \u043f\u0440\u044f\u043c\u0438\u0445 \u0437\u0430\u043f\u0438\u0442\u0456\u0432 \u0434\u043e \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u0434\u043b\u044f \u043e\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u0456\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u0457 \u0432 \u0431\u0430\u0437\u0456 \u0434\u0430\u043d\u0438\u0445 WordPress, \u043f\u043e\u043b\u044f\u0433\u0430\u0454 \u0432 \u0442\u043e\u043c\u0443, \u0449\u043e \u0432\u0438 \u0437\u0430\u043b\u0438\u0448\u0430\u0454\u0442\u0435 \u0441\u0435\u0431\u0435 \u0432\u0456\u0434\u043a\u0440\u0438\u0442\u0438\u043c\u0438 \u0434\u043b\u044f \u0447\u043e\u0433\u043e\u0441\u044c \u043d\u0430 \u0437\u0440\u0430\u0437\u043e\u043a:<\/p>\n<blockquote>\n<p>\u0422\u0430\u043a, \u0430\u043b\u0435 \u0454 API, \u0449\u043e\u0431 \u0440\u043e\u0431\u0438\u0442\u0438 \u0449\u043e\u0441\u044c \u043f\u043e\u0434\u0456\u0431\u043d\u0435.<\/p>\n<\/blockquote>\n<p>\u0406 \u0432 \u0431\u0430\u0433\u0430\u0442\u044c\u043e\u0445 \u0432\u0438\u043f\u0430\u0434\u043a\u0430\u0445 \u0446\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u042f \u0442\u0430\u043a\u043e\u0436 \u0432\u0435\u043b\u0438\u043a\u0438\u0439 \u043f\u0440\u0438\u0445\u0438\u043b\u044c\u043d\u0438\u043a \u0457\u0445 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u0430\u043d\u043d\u044f. \u0410\u043b\u0435 \u0431\u0443\u0432\u0430\u044e\u0442\u044c \u0432\u0438\u043f\u0430\u0434\u043a\u0438, \u043a\u043e\u043b\u0438 \u043f\u0440\u044f\u043c\u0456, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u0456 \u0437\u0430\u043f\u0438\u0442\u0438 \u0434\u043e \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u043c\u043e\u0436\u0443\u0442\u044c \u0431\u0443\u0442\u0438 \u0431\u0456\u043b\u044c\u0448 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u0438\u043c \u0432\u0438\u0431\u043e\u0440\u043e\u043c.<\/p>\n<p><a href=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-159831-61e6fe995df5b.jpg\" data-rel=\"lightbox\" ><img decoding=\"async\" class=\"SDStudio-light-box-enable SDStudio-editor-tools-md-imp\" src=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-159831-61e6fe995df5b.jpg\" alt=\"\u0417\u0430\u043f\u0438\u0442\u0438 \u0434\u043e \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u0434\u043b\u044f \u0448\u0432\u0438\u0434\u043a\u043e\u0433\u043e \u043e\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u0434\u0430\u043d\u0438\u0445, \u0447\u0430\u0441\u0442\u0438\u043d\u0430 1\" ><\/a><\/p>\n<p>\u041d\u0456, \u0446\u0435 \u043d\u0435 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u0438\u0445, \u0430\u043b\u0435 \u0447\u0438 \u043d\u0435 \u0431\u0443\u043b\u043e \u0431 \u0447\u0443\u0434\u043e\u0432\u043e, \u044f\u043a\u0431\u0438 \u0432\u043e\u043d\u0438 \u0432\u0438\u0433\u043b\u044f\u0434\u0430\u043b\u0438 \u0442\u0430\u043a? \u0424\u043e\u0442\u043e \u0422\u043e\u0431\u0456\u0430\u0441\u0430 \u0424\u0456\u0448\u0435\u0440\u0430 \u043d\u0430 Unsplash<\/p>\n<p>\u0426\u0435, \u0437\u0432\u0438\u0447\u0430\u0439\u043d\u043e, \u0437\u0430\u043b\u0435\u0436\u0438\u0442\u044c \u0432\u0456\u0434 \u0441\u0435\u0440\u0435\u0434\u043e\u0432\u0438\u0449\u0430, \u0432 \u044f\u043a\u043e\u043c\u0443 \u0432\u0438 \u043f\u0440\u0430\u0446\u044e\u0454\u0442\u0435, \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u043d\u043e \u0434\u043e \u0432\u0438\u043c\u043e\u0433 \u0432\u0430\u0448\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443.<\/p>\n<p>\u041e\u0442\u0436\u0435, \u0446\u0435 \u0449\u0435 \u043e\u0434\u043d\u0430 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u044f, \u044f\u043a\u0430 \u0431\u0443\u0434\u0435 \u0456\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0456\u0454\u044e \u0442\u043e\u0433\u043e, \u044f\u043a \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 <a href=\"https:\/\/codex.wordpress.org\/Class_Reference\/wpdb\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">$wpdb<\/a> \u0434\u043b\u044f \u0448\u0432\u0438\u0434\u043a\u043e\u0433\u043e \u043e\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u0456\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u0457 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0456 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u0438\u0445 (\u0431\u0435\u0437 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u0430\u043d\u043d\u044f \u0447\u043e\u0433\u043e\u0441\u044c \u043d\u0430 \u0437\u0440\u0430\u0437\u043e\u043a <a href=\"https:\/\/codex.wordpress.org\/Class_Reference\/WP_Query\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">WP_Query<\/a> \u0430\u0431\u043e <a href=\"https:\/\/codex.wordpress.org\/Class_Reference\/WP_Meta_Query\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">WP_Meta_Query<\/a> \u0434\u043b\u044f \u0457\u0457 \u043e\u0431\u0440\u043e\u0431\u043a\u0438).<\/p>\n<p>\u042f \u0437\u0431\u0438\u0440\u0430\u044e\u0441\u044f \u0440\u043e\u0437\u0434\u0456\u043b\u0438\u0442\u0438 \u0446\u0435 \u043d\u0430 \u0434\u0432\u0456 \u0447\u0430\u0441\u0442\u0438\u043d\u0438, \u0442\u043e\u043c\u0443 \u0449\u043e \u043f\u043e\u0447\u0430\u0442\u043a\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0456\u044f, \u044f\u043a\u0443 \u044f \u0437\u0431\u0438\u0440\u0430\u044e\u0441\u044f \u0432\u0430\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0438, \u0432\u0438\u043a\u043e\u043d\u0443\u0454 \u0431\u0456\u043b\u044c\u0448\u0435 \u043d\u0456\u0436 \u043e\u0434\u043d\u0443 \u0434\u0456\u044e.<\/p>\n<p>\u042f \u043d\u0435 \u043f\u0440\u0438\u0445\u0438\u043b\u044c\u043d\u0438\u043a \u0446\u044c\u043e\u0433\u043e.<\/p>\n<p>\u041f\u043e-\u0434\u0440\u0443\u0433\u0435, \u0446\u0435 \u0442\u0430\u043a\u043e\u0436 \u043c\u043e\u0436\u043b\u0438\u0432\u0456\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0435\u043a\u0442\u0443\u0432\u0430\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0456\u0457, \u0449\u043e\u0431 \u0432\u043e\u043d\u0438 \u0432\u0435\u043b\u0438 \u0441\u0435\u0431\u0435 \u0431\u0456\u043b\u044c\u0448 \u043e\u0431\u2019\u0454\u043a\u0442\u043d\u043e-\u043e\u0440\u0456\u0454\u043d\u0442\u043e\u0432\u0430\u043d\u0438\u043c\u0438 (\u0446\u0435 \u0442\u0435, \u0447\u043e\u0433\u043e <a href=\"https:\/\/tommcfarlin.com\/tag\/object-oriented-programming-in-wordpress\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u044f \u043f\u0440\u0438\u0445\u0438\u043b\u044c\u043d\u0438\u043a<\/a> \u0456 \u0449\u043e <a href=\"https:\/\/tommcfarlin.com\/object-oriented-programming-using-wordpress\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u044f \u0437\u0430\u0432\u0436\u0434\u0438 \u0440\u0430\u0434\u0438\u0439 \u043f\u0440\u043e\u0441\u0443\u0432\u0430\u0442\u0438<\/a> ).<\/p>\n<p>\u0410\u043b\u0435 \u043d\u0430\u0440\u0430\u0437\u0456 \u0434\u043e\u0437\u0432\u043e\u043b\u044c\u0442\u0435 \u043c\u0435\u043d\u0456 \u0432\u0438\u043a\u043b\u0430\u0441\u0442\u0438 \u0441\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0438<\/p>\n<ol>\n<li>\u042f \u0456\u043c\u043f\u043e\u0440\u0442\u0443\u044e \u0442\u0440\u043e\u0445\u0438 \u0456\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u0457 \u0437\u0456 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u044c\u043e\u0433\u043e API.<\/li>\n<li>\u0406\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u044f \u0432\u0456\u0434\u043e\u0431\u0440\u0430\u0436\u0430\u0454\u0442\u044c\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0456 wp_posts, \u0430 \u0442\u0430\u043a\u043e\u0436 \u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0456 wp_postmeta.<\/li>\n<li>\u0406\u0441\u043d\u0443\u044e\u0442\u044c \u043f\u0435\u0432\u043d\u0456 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u0456, \u044f\u043a\u0456 \u0454 \u043a\u0440\u0438\u0442\u0435\u0440\u0456\u044f\u043c\u0438 \u0434\u043b\u044f \u0432\u0438\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f \u0441\u0442\u0430\u0442\u0443\u0441\u0443 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u0457. \u0410\u0431\u043e, \u043f\u0440\u044f\u043c\u0456\u0448\u0435 \u043a\u0430\u0436\u0443\u0447\u0438, \u044f\u043a\u0449\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u0438\u0445 \u043f\u0440\u0438\u0441\u0443\u0442\u043d\u0456\u0439, \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u0457 \u043f\u043e\u0432\u0438\u043d\u0435\u043d \u0431\u0443\u0442\u0438 \u0432\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u043d\u0430 \u0447\u0435\u0440\u043d\u0435\u0442\u043a\u0443, \u0449\u043e\u0431 \u0432\u043e\u043d\u0430 \u043d\u0435 \u0432\u0456\u0434\u043e\u0431\u0440\u0430\u0436\u0430\u043b\u0430\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c\u0443 \u0437\u0430\u043f\u0438\u0442\u0456.<\/li>\n<\/ol>\n<p>\u0429\u043e\u0431 \u0432\u0438\u0440\u0456\u0448\u0438\u0442\u0438 \u0446\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0437\u0440\u043e\u0431\u0438\u0442\u0438 \u0434\u0432\u0456 \u0440\u0435\u0447\u0456:<\/p>\n<ol>\n<li>\u041d\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u0456 \u0456\u0434\u0435\u043d\u0442\u0438\u0444\u0456\u043a\u0430\u0442\u043e\u0440\u0438 \u043f\u043e\u0441\u0442\u0456\u0432,<\/li>\n<li>\u0406 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0437\u043c\u0456\u043d\u0438\u0442\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0441\u0442\u0456\u0432.<\/li>\n<\/ol>\n<p>\u041f\u0435\u0440\u0448 \u043d\u0456\u0436 \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u0442\u0438 \u0437\u0430\u043f\u0438\u0442\u0438 \u0442\u0430 \u0440\u0435\u0448\u0442\u0443 \u043a\u043e\u0434\u0443, \u043f\u0440\u0438\u043f\u0443\u0441\u0442\u0456\u043c\u043e, \u0449\u043e \u043c\u0435\u0442\u0430-\u043a\u043b\u044e\u0447, \u044f\u043a\u0438\u0439 \u043c\u0438 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0454\u043c\u043e, \u0442\u0432\u043e\u0440\u0447\u043e \u043d\u0430\u0437\u0438\u0432\u0430\u0454\u0442\u044c\u0441\u044f <strong>acme-status<\/strong>. \u0406 \u0437 \u0446\u044c\u043e\u0433\u043e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0447\u043d\u0435\u043c\u043e.<\/p>\n<h3>1 \u0412\u0456\u0437\u044c\u043c\u0456\u0442\u044c \u0456\u0434\u0435\u043d\u0442\u0438\u0444\u0456\u043a\u0430\u0442\u043e\u0440\u0438 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u0439 \u0456\u0437 \u043f\u043e\u0432\u2019\u044f\u0437\u0430\u043d\u0438\u043c \u043c\u0435\u0442\u0430-\u043a\u043b\u044e\u0447\u0435\u043c<\/h3>\n<p>\u0421\u043f\u043e\u0447\u0430\u0442\u043a\u0443 \u043c\u0438 \u0441\u0442\u0432\u043e\u0440\u0438\u043c\u043e \u0444\u0443\u043d\u043a\u0446\u0456\u044e \u043f\u0456\u0434 \u043d\u0430\u0437\u0432\u043e\u044e <strong>setInactivePosts.<\/strong> \u0426\u0435 \u0431\u0456\u043b\u044c\u0448 \u0437\u0430\u0433\u0430\u043b\u044c\u043d\u0435, \u043d\u0456\u0436 \u0446\u0435 \u0431\u0443\u043b\u043e \u0431, \u044f\u043a\u0449\u043e \u0432\u0438 \u043f\u0440\u0430\u0446\u044e\u0454\u0442\u0435 \u0432 \u043f\u0435\u0432\u043d\u043e\u043c\u0443 \u0434\u043e\u043c\u0435\u043d\u0456, \u0430\u043b\u0435 \u0432\u0438 \u0440\u043e\u0437\u0443\u043c\u0456\u0454\u0442\u0435 \u0441\u0443\u0442\u044c.<\/p>\n<p>\u041f\u043e\u0442\u0456\u043c \u043c\u0438 \u0437\u0431\u0438\u0440\u0430\u0454\u043c\u043e\u0441\u044f \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u0442\u0438 \u0437\u0430\u043f\u0438\u0442, \u044f\u043a\u0438\u0439 \u0431\u0443\u0434\u0435 <a href=\"https:\/\/gist.github.com\/tommcfarlin\/a4b657f93a5df41274f5b4744975d265#file-00-set-inactive-posts-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u043e\u0442\u0440\u0438\u043c\u0443\u0432\u0430\u0442\u0438 \u0432\u0441\u0456 \u0456\u0434\u0435\u043d\u0442\u0438\u0444\u0456\u043a\u0430\u0442\u043e\u0440\u0438 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u0439, \u044f\u043a\u0456 \u043c\u0430\u044e\u0442\u044c \u0446\u0435\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0438\u0439 \u043c\u0435\u0442\u0430-\u043a\u043b\u044e\u0447<\/a> :<\/p>\n<pre><code>&lt;?php\n\nfunction setInactivePosts()\n{\n    \/\/ First, find the post IDs with an empty acme-status.\n    global $wpdb;\n    $results = $wpdb-&gt;get_results(\n        $wpdb-&gt;prepare(\n            \"\n            SELECT post_id\n            FROM $wpdb-&gt;postmeta\n            WHERE meta_key = %s\n            AND meta_value = ''\n            \",\n            'acme-status') );\n\n  \/\/ More to come...\n<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u043c\u0438 \u043c\u0430\u0454\u043c\u043e \u043c\u0430\u0441\u0438\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0456\u0432. \u0410\u043b\u0435 \u043f\u0435\u0440\u0448 \u043d\u0456\u0436 \u0449\u043e\u0441\u044c \u0440\u043e\u0431\u0438\u0442\u0438, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u043f\u0435\u0440\u0435\u043a\u043e\u043d\u0430\u0442\u0438\u0441\u044f, \u0449\u043e \u0443 \u043d\u0430\u0441 \u0454 \u0434\u0430\u043d\u0456, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0456 \u044f\u043a\u0438\u0445 \u043c\u043e\u0436\u043d\u0430 \u043f\u0440\u0430\u0446\u044e\u0432\u0430\u0442\u0438.<\/p>\n<h3>2 \u0412\u0438\u0439\u0442\u0438 \u0440\u0430\u043d\u0456\u0448\u0435?<\/h3>\n<p>\u041f\u0435\u0440\u0448 \u043d\u0456\u0436 \u043f\u0440\u043e\u0434\u043e\u0432\u0436\u0443\u0432\u0430\u0442\u0438 \u043e\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u0456\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u0457, \u043c\u0438 \u043f\u043e\u0432\u0438\u043d\u043d\u0456 \u043f\u0435\u0440\u0435\u0432\u0456\u0440\u0438\u0442\u0438, \u0447\u0438 \u0454 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0438. <a href=\"https:\/\/gist.github.com\/tommcfarlin\/a4b657f93a5df41274f5b4744975d265#file-01-return-early-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0410 \u044f\u043a\u0449\u043e \u0457\u0445 \u043d\u0435\u043c\u0430\u0454?<\/a><\/p>\n<pre><code>&lt;?php\n\n\/\/ See previous gist.\n\n\/\/ If there aren't any results, there's nothing to do.\nif (0 === count($results)) {\n    return;\n}\n\n\/\/ More to come...<\/code><\/pre>\n<p>\u0422\u043e\u0434\u0456 \u043c\u0438 \u043c\u043e\u0436\u0435\u043c\u043e \u0432\u0442\u0435\u043a\u0442\u0438.<\/p>\n<h3>3 \u041e\u043d\u043e\u0432\u0456\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u0457<\/h3>\n<p>\u0410\u043b\u0435 \u044f\u043a\u0449\u043e \u0454 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0438, \u043c\u0438 \u043f\u043e\u0432\u0438\u043d\u043d\u0456 \u043f\u0435\u0440\u0435\u0433\u043b\u044f\u043d\u0443\u0442\u0438 \u0457\u0445 \u0456 \u043e\u043d\u043e\u0432\u0438\u0442\u0438 <a href=\"https:\/\/gist.github.com\/tommcfarlin\/a4b657f93a5df41274f5b4744975d265#file-02-update-post-status-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u0457<\/a> :<\/p>\n<pre><code>&lt;?php\n\n\/\/ See previous gist.\n\n\/\/ Otherwise, set the post_status of the specified post IDs to 'draft'.\nforeach ($results as $result) {\n    $wpdb-&gt;get_results(\n        $wpdb-&gt;prepare(\n            \"\n            UPDATE $wpdb-&gt;posts\n            SET post_status = %s\n            WHERE ID = %d\n            \",\n            'draft',\n            (int) ($result-&gt;post_id)) );\n}<\/code><\/pre>\n<p>\u0422\u043e \u044f\u043a \u0446\u0435 \u0432\u0441\u0435 \u0440\u0430\u0437\u043e\u043c \u0432\u0438\u0433\u043b\u044f\u0434\u0430\u0454?<\/p>\n<h3>4 \u0412\u0441\u0456 \u0440\u0430\u0437\u043e\u043c<\/h3>\n<p>\u041a\u043e\u043b\u0438 \u043c\u0438 \u043e\u0431\u2019\u0454\u0434\u043d\u0430\u0454\u043c\u043e <a href=\"https:\/\/gist.github.com\/tommcfarlin\/a4b657f93a5df41274f5b4744975d265#file-03-set-inactive-posts-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0446\u044e \u0444\u0443\u043d\u043a\u0446\u0456\u044e, \u0431\u0456\u043b\u044c\u0448\u0443, \u043d\u0456\u0436 \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e, \u0432\u0438 \u043f\u043e\u0431\u0430\u0447\u0438\u0442\u0435 \u043e\u0441\u044c \u0449\u043e<\/a> :<\/p>\n<pre><code>&lt;?php\n\nfunction setInactivePosts()\n{\n    \/\/ First, find the post IDs with an empty acme-status.\n    global $wpdb;\n    $results = $wpdb-&gt;get_results(\n        $wpdb-&gt;prepare(\n            \"\n            SELECT post_id\n            FROM $wpdb-&gt;postmeta\n            WHERE meta_key = %s\n            AND meta_value = ''\n            \",\n            'acme-status') );\n\n    \/\/ If there aren't any results, there's nothing to do.\n    if (0 === count($results)) {\n        return;\n    }\n\n    \/\/ Otherwise, set the post_status of the specified post IDs to 'draft'.\n    foreach ($results as $result) {\n        $wpdb-&gt;get_results(\n            $wpdb-&gt;prepare(\n                \"\n                UPDATE $wpdb-&gt;posts\n                SET post_status = %s\n                WHERE ID = %d\n                \",\n                'draft',\n                (int) ($result-&gt;post_id)) );\n    }\n}<\/code><\/pre>\n<p>\u0410\u043b\u0435 \u0432 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0456\u0439 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u0457 \u043c\u0438 \u0442\u0440\u043e\u0445\u0438 \u0440\u0435\u043e\u0440\u0433\u0430\u043d\u0456\u0437\u0443\u0454\u043c\u043e \u0446\u0435, \u0449\u043e\u0431 \u0437\u0440\u043e\u0431\u0438\u0442\u0438 \u0439\u043e\u0433\u043e \u0431\u0456\u043b\u044c\u0448 \u043e\u0431\u2019\u0454\u043a\u0442\u043d\u043e-\u043e\u0440\u0456\u0454\u043d\u0442\u043e\u0432\u0430\u043d\u0438\u043c.<\/p>\n<h3>\u041f\u0440\u0438\u043c\u0456\u0442\u043a\u0430 \u0434\u043b\u044f \u0430\u0434\u043c\u0456\u043d\u0456\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0456\u0432 \u0431\u0430\u0437 \u0434\u0430\u043d\u0438\u0445<\/h3>\n<p>\u0414\u043b\u044f \u0442\u0438\u0445 \u0456\u0437 \u0432\u0430\u0441, \u0445\u0442\u043e \u0434\u043e\u0431\u0440\u0435 \u0440\u043e\u0437\u0431\u0438\u0440\u0430\u0454\u0442\u044c\u0441\u044f \u0432 SQL-fu, \u0432\u0438 \u0437\u043d\u0430\u0454\u0442\u0435, \u0449\u043e \u0446\u0435, \u0448\u0432\u0438\u0434\u0448\u0435 \u0437\u0430 \u0432\u0441\u0435, \u043c\u043e\u0436\u043d\u0430 \u0432\u0438\u0440\u0456\u0448\u0438\u0442\u0438 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043e\u0434\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0438\u0442\u0443; \u043e\u0434\u043d\u0430\u043a \u043c\u0435\u0442\u0430 \u0446\u044c\u043e\u0433\u043e \u0434\u043e\u043f\u0438\u0441\u0443 \u0442\u0430 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u0434\u043e\u043f\u0438\u0441\u0443 \u043f\u043e\u0434\u0432\u0456\u0439\u043d\u0430:<\/p>\n<ol>\n<li>\u0429\u043e\u0431 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0438, \u044f\u043a \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 $wpdb \u0434\u043b\u044f \u0448\u0432\u0438\u0434\u043a\u043e\u0433\u043e \u0434\u043e\u0441\u044f\u0433\u043d\u0435\u043d\u043d\u044f \u0447\u043e\u0433\u043e\u0441\u044c,<\/li>\n<li>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u0438, \u044f\u043a \u0440\u043e\u0437\u0431\u0438\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u043d\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432\u0438\u043a\u043e\u043d\u0430\u043d\u043d\u044f \u0447\u043e\u0433\u043e\u0441\u044c \u043d\u0430 \u043e\u0431\u2019\u0454\u043a\u0442\u043d\u043e-\u043e\u0440\u0456\u0454\u043d\u0442\u043e\u0432\u0430\u043d\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432\u0438\u043a\u043e\u043d\u0430\u043d\u043d\u044f \u0447\u043e\u0433\u043e\u0441\u044c.<\/li>\n<\/ol>\n<p>\u0417 \u043e\u0433\u043b\u044f\u0434\u0443 \u043d\u0430 \u0446\u0435, \u0434\u044f\u043a\u0443\u044e \u0437\u0430 \u0432\u0441\u0456 \u0437\u0430\u043f\u0438\u0442\u0430\u043d\u043d\u044f. \ud83d\udc4d\ud83c\udffb<\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0414\u0436\u0435\u0440\u0435\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0443:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/tommcfarlin.com\" class=\"external external_icon\">tommcfarlin.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0426\u0435 \u0449\u0435 \u043e\u0434\u043d\u0430 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u044f, \u044f\u043a\u0430 \u0431\u0443\u0434\u0435 \u0456\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0456\u0454\u044e \u0442\u043e\u0433\u043e, \u044f\u043a \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 $wpdb \u0434\u043b\u044f \u0448\u0432\u0438\u0434\u043a\u043e\u0433\u043e \u043e\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u0456\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u0457 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043f\u0440\u044f\u043c\u0438\u0445 \u0437\u0430\u043f\u0438\u0442\u0456\u0432 \u0434\u043e \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445.<\/p>\n","protected":false},"author":1,"featured_media":237054,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[869,839,902,849,923,725],"tags":[1174],"class_list":["post-231393","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress-10","category-kerivnytstvo-dlia-pochatkivtsiv","category-kod-3","category-pidruchnyky","category-inshyj","category-rozrobnyk","tag-affiai-uk"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts\/231393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/comments?post=231393"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts\/231393\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/media\/237054"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/media?parent=231393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/categories?post=231393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/tags?post=231393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}