-1, 'post_status' => 'any', 'post_type' => 'post', ); $posts_list = get_posts($get_posts_args); return $posts_list; } function mp_posts_published($posts_list) { $posts_published = []; foreach ($posts_list as $post) { $status = $post->post_status; if ($status == "publish") array_push($posts_published, $post); } return $posts_published; } function mp_have_no_address($posts_list) { $posts_no_address = []; foreach ($posts_list as $post) { $address = mp_get_address($post->ID); if (empty($address)) array_push($posts_no_address, $post); } return $posts_no_address; } function mp_have_no_coordinates($posts_list) { $posts_no_coordinates = []; foreach ($posts_list as $post) { $location = get_field("location", $post->ID); if (empty($location)) array_push($posts_no_coordinates, $post); else if (empty($location->coordinates)) array_push($posts_no_coordinates, $post); } return $posts_no_coordinates; } function mp_bad_categories($posts_list) { $posts_bad_categories = []; foreach ($posts_list as $post) { $value = get_field("categorie", $post->ID); if (! is_string($value)) { array_push($posts_bad_categories, $post); //mp_console_log("categorie:"); //mp_console_log($value); } if (str_starts_with($value, '["')) { array_push($posts_bad_categories, $post); } } return $posts_bad_categories; } function count_publish($arr_posts) { return($arr_posts->post_status === "publish"); } function mp_show_list_posts_no_address($posts) { $all_posts = count($posts); $published_posts = count(array_filter($posts, "count_publish")); echo <<

ATTENTION !

HTML; echo "$all_posts"; echo "$published_posts"; echo ''; if (count($posts) == 1) echo " article n'a pas d'adresse :"; else echo " articles n'ont pas d'adresses :"; echo <<