{"id":794,"date":"2019-03-04T10:06:10","date_gmt":"2019-03-04T01:06:10","guid":{"rendered":"https:\/\/nendeb.com\/?p=794"},"modified":"2019-03-04T10:06:10","modified_gmt":"2019-03-04T01:06:10","slug":"%e3%83%a6%e3%83%bc%e3%82%b6%e3%83%bc%e3%82%92%e5%89%8a%e9%99%a4%e3%81%99%e3%82%8b%e9%9a%9b%e3%81%ab%e8%ad%a6%e5%91%8a%e3%81%99%e3%82%8b%e3%81%8b-%e3%82%b3%e3%83%b3%e3%83%86%e3%83%b3%e3%83%84%e3%81%ae","status":"publish","type":"post","link":"https:\/\/nendeb.com\/794","title":{"rendered":"\u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3059\u308b\u969b\u306b\u8b66\u544a\u3059\u308b\u304b \u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u6240\u6709\u8005\u3092\u5f37\u5236\u5909\u66f4\u3059\u308b"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nendeb.com\/wp-content\/uploads\/main_userdelete-ck.png\" alt=\"\" width=\"1200\" height=\"675\" class=\"alignnone size-full wp-image-797\" \/><br \/>\nWordPress\u306e\u7ba1\u7406\u753b\u9762\u3067\u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3059\u308b\u969b\u3001\u524a\u9664\u30e6\u30fc\u30b6\u30fc\u304c\u6240\u6709\u3059\u308b\u30b3\u30f3\u30c6\u30f3\u30c4\u3092 \u3059\u3079\u3066\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u6d88\u53bb\u3059\u308b\u304b\u3001\u4ed6\u306e\u30e6\u30fc\u30b6\u30fc\u3078\u79fb\u3059\u304b\u3069\u3046\u304b\u805e\u3044\u3066\u304d\u307e\u3059\u306e\u3067 \u5fc5\u8981\u306a\u3089\u3070\u305d\u306e\u969b\u306b\u79fb\u3059\u5148\u306e\u30e6\u30fc\u30b6\u30fc\u3092\u9078\u629e\u3057\u3066\u30e6\u30fc\u30b6\u30fc\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n<p>\u300c\u3059\u3079\u3066\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u6d88\u53bb\u3057\u307e\u3059\u300d\u3092\u9078\u629e\u3057\u305f\u5834\u5408 \u6295\u7a3f\u3084\u56fa\u5b9a\u30da\u30fc\u30b8\u306e\u30c7\u30fc\u30bf\u306f\u3054\u307f\u7bb1\u306b\u5165\u308a\u307e\u3059\u304c\u3001\u753b\u50cf\u3084\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f(\u7269\u4ef6\u3084\u5546\u54c1\u7b49)\u306e\u30c7\u30fc\u30bf\u306f\u5b8c\u5168\u306b\u524a\u9664\u3055\u308c\u307e\u3059\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nendeb.com\/wp-content\/uploads\/delete_user_794_1.png\" alt=\"\" width=\"1059\" height=\"451\" class=\"alignnone size-full wp-image-795\" \/><br \/>\n\u305d\u308c\u3092\u3088\u304f\u78ba\u8a8d\u3057\u306a\u3044\u3067\u30e6\u30fc\u30b6\u30fc\u524a\u9664\u3057\u3066\u3057\u307e\u3046\u7ba1\u7406\u8005\u304c\u3044\u308b\u3088\u3046\u3067\u3001<del>\u4f55\u3082\u3057\u3066\u306a\u3044\u306e\u306b<\/del>\u6295\u7a3f\u3084\u753b\u50cf\u304c\u3044\u3064\u306e\u307e\u306b\u304b\u6d88\u3048\u305f \u3068 \u305f\u307e\u306b \u8a00\u308f\u308c\u308b\u4e8b\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067 \u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3059\u308b\u969b\u3001\u8b66\u544a\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u8868\u793a\u3059\u308b\u304b\u3001\u524a\u9664\u30e6\u30fc\u30b6\u30fc\u306e\u6301\u3063\u3066\u3044\u308b\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u6240\u6709\u8005\u3092\u30e6\u30fc\u30b6\u30fc\u524a\u9664\u524d\u306b\u5f37\u5236\u7684\u306b\u5909\u66f4\u3059\u308bTips\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u3000<\/p>\n<h2>\u30b3\u30fc\u30c9<\/h2>\n<p>\u4ee5\u4e0b\u306e\u3069\u3061\u3089\u304b\u306e\u30b3\u30fc\u30c9\u3092 <a href=\"https:\/\/nendeb.com\/1\" target=\"blank\">my-plugin.php<\/a> \u306b\u5f35\u308a\u4ed8\u3051\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>\u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3059\u308b\u969b\u3001\u8b66\u544a\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u8868\u793a\u3059\u308b\u3002<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nendeb.com\/wp-content\/uploads\/delete_user_794_2.png\" alt=\"\" width=\"943\" height=\"425\" class=\"alignnone size-full wp-image-796\" \/><br \/>\n\u524a\u9664\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u304c\u4f55\u3089\u304b\u306e\u30b3\u30f3\u30c6\u30f3\u30c4(\u6295\u7a3f\u3084\u753b\u50cf)\u3092\u6240\u6709\u3057\u3066\u3044\u3066 \u300c\u3059\u3079\u3066\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u6d88\u53bb\u3057\u307e\u3059\u300d\u3092\u9078\u629e \u3057\u3066\u300c\u524a\u9664\u3092\u5b9f\u884c\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u305f\u6642\u306b\u8b66\u544a\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/**\r\n * \u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3059\u308b\u969b\u3001\u8b66\u544a\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u8868\u793a\u3059\u308b\u3002\r\n *\r\n * Fires at the end of the delete users form prior to the confirm button.\r\n *\r\n * @since 4.5.0\r\n * do_action( 'delete_user_form', $current_user, $userids );\r\n *\r\n * @param WP_User $current_user WP_User object for the current user.\r\n * @param array   $userids      Array of IDs for users being deleted.\r\n * License: GPLv2 or later\r\n *\/\r\nfunction nendebcom_delete_user_confirm() {\r\n\t?&gt;\r\n\t&lt;script type=&quot;text\/javascript&quot;&gt;\t\r\n\tjQuery(document).ready(function() {\r\n\t\t$('#submit').on('click', function(event) {\r\n\r\n\t\t\tif( $(&quot;#delete_option0&quot;).val() == &quot;delete&quot; &amp;&amp; $(&quot;input[name=delete_option]:checked&quot;).val() === &quot;delete&quot; ){\r\n\r\n\t\t\t\tif( window.confirm('\u524a\u9664\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u306e \u6240\u6709\u3057\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u6295\u7a3f\u3001\u7269\u4ef6\u3001\u753b\u50cf\u3092\u524a\u9664\u3057\u307e\u3059\u3002\\n\u300cOK\u300d\u3092\u62bc\u3059\u3068\u5143\u306b\u306f\u623b\u305b\u307e\u305b\u3093\u3002\\n\\n\u4e2d\u6b62\u3059\u308b\u306b\u306f\u300c\u30ad\u30e3\u30f3\u30bb\u30eb\u300d\u3092\u3001\u3059\u3079\u3066\u524a\u9664\u3057\u3066\u3044\u3044\u5834\u5408\u306f\u300cOK\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002' )){\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\t&lt;\/script&gt;\r\n\t&lt;?php\r\n}\r\nadd_action( 'delete_user_form', 'nendebcom_delete_user_confirm' );\r\n<\/pre>\n<p>\u3000<br \/>\n\u3000<\/p>\n<h3>\u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3059\u308b\u969b\u3001\u524a\u9664\u30e6\u30fc\u30b6\u30fc\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u6240\u6709\u8005\u3092\u5f37\u5236\u5909\u66f4\u3059\u308b\u3002<\/h3>\n<p>\u3044\u3063\u305d\u306e\u4e8b\u3001\u7121\u6761\u4ef6\u3067\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u6240\u6709\u8005\u3092\u5909\u66f4\u3057\u3066\u524a\u9664\u3055\u305b\u306a\u3044\u3088\u3046\u306b\u3057\u307e\u3059\u3002<br \/>\n\u524a\u9664\u5bfe\u8c61\u306e\u30e6\u30fc\u30b6\u30fc\u304c \u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u6301\u3063\u3066\u3044\u308b\u306e\u306b\u300c\u3059\u3079\u3066\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u6d88\u53bb\u3057\u307e\u3059\u300d\u3092\u9078\u629e\u3057\u3066 \u300c\u524a\u9664\u3092\u5b9f\u884c\u300d\u3057\u3066\u3057\u307e\u3063\u305f\u6642\u306b\u52d5\u4f5c\u3057\u307e\u3059\u3002<br \/>\n\u3053\u306e\u5834\u5408\u306f \u30e6\u30fc\u30b6\u30fc\u524a\u9664\u3092\u3057\u3066\u3044\u308b\u7ba1\u7406\u8005\u306b\u6240\u6709\u8005\u306f\u5909\u308f\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/**\r\n * \u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3059\u308b\u969b\u3001\u524a\u9664\u30e6\u30fc\u30b6\u30fc\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u6240\u6709\u8005\u3092\u5f37\u5236\u5909\u66f4\u3059\u308b\r\n *\r\n * @wp_delete_user\r\n *\r\n * do_action( 'delete_user', $id, $reassign );\r\n * @param int      $id       ID of the user to delete.\r\n * @param int|null $reassign ID of the user to reassign posts and links to.\r\n *                           Default null, for no reassignment.\r\n * License: GPLv2 or later\r\n *\/\r\nfunction nendebcom_delete_user_content2admin( $id, $reassign ) {\r\n\r\n\tglobal $wpdb;\r\n\tglobal $user_ID;\t\/\/\u73fe\u5728\u306e\u30e6\u30fc\u30b6\u30fcID\u3092\u53d6\u5f97\r\n\r\n\tif ( null === $reassign ) {\r\n\r\n\t\t$reassign = $user_ID;\t\/\/\u6240\u6709\u5909\u66f4\u5148\u306e\u30e6\u30fc\u30b6\u30fcID\r\n\r\n\t\t\/\/ for posts\r\n\t\t$post_ids = $wpdb-&gt;get_col( $wpdb-&gt;prepare( &quot;SELECT ID FROM $wpdb-&gt;posts WHERE post_author = %d&quot;, $id ) );\r\n\t\t$wpdb-&gt;update( $wpdb-&gt;posts, array('post_author' =&gt; $reassign), array('post_author' =&gt; $id) );\r\n\t\tif ( ! empty( $post_ids ) ) {\r\n\t\t\tforeach ( $post_ids as $post_id )\r\n\t\t\t\tclean_post_cache( $post_id );\r\n\t\t}\r\n\t}\r\n}\r\nadd_action( 'delete_user', 'nendebcom_delete_user_content2admin', 10, 2 );\r\n<\/pre>\n<p>\u5909\u66f4\u5148\u306e\u30e6\u30fc\u30b6\u30fc\u3092\u56fa\u5b9a\u3057\u305f\u3044\u5834\u5408\u306f $user_ID\u3092 \u5b9f\u6570\u5024(\u5909\u66f4\u5148\u306e\u30e6\u30fc\u30b6\u30fcID) \u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3000<br \/>\n\u3000<\/p>\n<h2 id=\"link\">\u53c2\u8003<\/h2>\n<p>delete_user_form | Hook | WordPress Developer Resources<br \/>\n<a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/delete_user_form\/\" target=\"_blank\"  rel=\"noopener nofollow\">https:\/\/developer.wordpress.org\/reference\/hooks\/delete_user_form\/<\/a><\/p>\n<p>delete_user | Hook | WordPress Developer Resources<br \/>\n<a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/delete_user\/\" target=\"_blank\"  rel=\"noopener nofollow\">https:\/\/developer.wordpress.org\/reference\/hooks\/delete_user\/<\/a><\/p>\n<p><!--\n<a href=\"\" target=\"_blank\"  rel=\"noopener nofollow\"><\/a>\ndelete_user_form,delete_user\n--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u306e\u7ba1\u7406\u753b\u9762\u3067\u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3059\u308b\u969b\u3001\u524a\u9664\u30e6\u30fc\u30b6\u30fc\u304c\u6240\u6709\u3059\u308b\u30b3\u30f3\u30c6\u30f3\u30c4\u3092 \u3059\u3079\u3066\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u6d88\u53bb\u3059\u308b\u304b\u3001\u4ed6\u306e\u30e6\u30fc\u30b6\u30fc\u3078\u79fb\u3059\u304b\u3069\u3046\u304b\u805e\u3044\u3066\u304d\u307e\u3059\u306e\u3067 \u5fc5\u8981\u306a\u3089\u3070\u305d\u306e\u969b\u306b\u79fb\u3059\u5148\u306e\u30e6\u30fc\u30b6\u30fc\u3092\u9078\u629e\u3057\u3066\u30e6\u30fc\u30b6\u30fc\u524a\u9664\u3057\u307e\u3059\u3002 \u300c\u3059\u3079\u3066\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u6d88\u53bb\u3057\u307e\u3059\u300d\u3092\u9078\u629e\u3057\u305f\u5834\u5408 \u6295\u7a3f\u3084\u56fa\u5b9a\u30da\u30fc\u30b8\u306e\u30c7\u30fc\u30bf\u306f\u3054&hellip;<\/p>\n","protected":false},"author":1,"featured_media":797,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[166,165],"class_list":["post-794","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-delete_user","tag-delete_user_form"],"jetpack_featured_media_url":"https:\/\/nendeb.com\/wp-content\/uploads\/main_userdelete-ck.png","_links":{"self":[{"href":"https:\/\/nendeb.com\/wp-json\/wp\/v2\/posts\/794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nendeb.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nendeb.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nendeb.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nendeb.com\/wp-json\/wp\/v2\/comments?post=794"}],"version-history":[{"count":0,"href":"https:\/\/nendeb.com\/wp-json\/wp\/v2\/posts\/794\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nendeb.com\/wp-json\/wp\/v2\/media\/797"}],"wp:attachment":[{"href":"https:\/\/nendeb.com\/wp-json\/wp\/v2\/media?parent=794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nendeb.com\/wp-json\/wp\/v2\/categories?post=794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nendeb.com\/wp-json\/wp\/v2\/tags?post=794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}