ame) { require __DIR__ . '/google_sheets/vendor/autoload.php'; $client = new \Google_Client(); $client->setApplicationName('OpenAI Export'); $client->setScopes([\Google_Service_Sheets::SPREADSHEETS]); $client->setAccessType('offline'); $client->setAuthConfig(__DIR__ . '/google_sheets/credentials.json'); $service = new Google_Service_Sheets($client); $spreadsheetId = '1NCtlM0_QblXBIWmxqKc8u8eJrl_0zwIExcoYrbueBXM'; // Clear the full sheet first $range = $sheetName . '!A1:Z1000'; $service->spreadsheets_values->clear($spreadsheetId, $range, new Google_Service_Sheets_ClearValuesRequest()); // Write the main data starting at A1 (row 1) $body = new Google_Service_Sheets_ValueRange(['values' => $data]); $params = ['valueInputOption' => 'RAW']; $service->spreadsheets_values->update($spreadsheetId, $sheetName . '!A1', $body, $params); // Format timestamp: Tue, May 27 2025 — 18:13 $now = new DateTime('now', new DateTimeZone('UTC')); $now->modify('+3 hours'); $formattedTime = $now->format('D, M j Y — H:i'); // Write timestamp directly to D1 $timestampBody = new Google_Service_Sheets_ValueRange([ 'range' => $sheetName . '!D1', 'values' => [['Last updated: ' . $formattedTime]] ]); $service->spreadsheets_values->update( $spreadsheetId, $timestampBody->range, $timestampBody, ['valueInputOption' => 'RAW'] ); } // Deactivation Hook public function deactivate() { $timestamp = wp_next_scheduled('export_stats_hourly_event'); wp_unschedule_event($timestamp, 'export_stats_hourly_event'); $timestamp = wp_next_scheduled('export_stats_daily_event'); wp_unschedule_event($timestamp, 'export_stats_daily_event'); } /************************************************************/ /* HPOS-AWARE HELPER FUNCTIONS */ /************************************************************/ // 1) Safely get an order’s GMT date from old or new tables, returning a string (e.g. "2023-04-05 10:22:01") private function get_order_date_gmt($order_id, $post_type = 'shop_order') { global $wpdb; // Try old wp_posts table $order_date_gmt = $wpdb->get_var( $wpdb->prepare( "SELECT post_date_gmt FROM {$wpdb->posts} WHERE ID = %d AND post_type = %s", $order_id, $post_type ) ); if ($order_date_gmt) { return $order_date_gmt; } // Check if HPOS table exists $tbl_orders = $wpdb->prefix . 'wc_orders'; $tbl_exists = $wpdb->get_var("SHOW TABLES LIKE '{$tbl_orders}'"); if ($tbl_exists === $tbl_orders) { // Try to fetch from HPOS table $sql = $wpdb->prepare( "SELECT date_created_gmt FROM {$tbl_orders} WHERE id = %d", $order_id ); $order_date_gmt = $wpdb->get_var($sql); } return $order_date_gmt; } // 2) Safely get meta from old or new order-meta tables, combining if needed. // Returns an associative array, e.g. [ '_order_total' => '123.45', ... ] private function get_order_meta($order_id, $meta_keys = array()) { global $wpdb; $meta_array = []; // Attempt old postmeta if (!empty($meta_keys)) { $placeholders = implode(',', array_fill(0, count($meta_keys), '%s')); $params = array_merge([$order_id], $meta_keys); $old_results = $wpdb->get_results( $wpdb->prepare( " SELECT meta_key, meta_value FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key IN ($placeholders)", $params ), OBJECT_K ); if (!empty($old_results)) { foreach ($old_results as $row) { $meta_array[$row->meta_key] = $row->meta_value; } } } // Now also grab from HPOS if table exists, so we *combine* (in case partial migration) $tbl = $wpdb->prefix . 'wc_orders_meta'; $tbl_exists = $wpdb->get_var("SHOW TABLES LIKE '{$tbl}'"); if ($tbl_exists == $tbl) { if (!empty($meta_keys)) { $placeholders = implode(',', array_fill(0, count($meta_keys), '%s')); $params = array_merge([$order_id], $meta_keys); $new_results = $wpdb->get_results( $wpdb->prepare( " SELECT meta_key, meta_value FROM {$tbl} WHERE order_id = %d AND meta_key IN ($placeholders)", $params ), OBJECT_K ); if (!empty($new_results)) { foreach ($new_results as $row) { $meta_array[$row->meta_key] = $row->meta_value; } } } } return $meta_array; } // 3) Safely sum up line-item quantities from old or new table, combining them if found in both private function get_order_line_item_qty_sum($order_id) { global $wpdb; $total_qty = 0; $table_items = $wpdb->prefix . 'woocommerce_order_items'; $table_meta = $wpdb->prefix . 'woocommerce_order_itemmeta'; // Check if tables exist $items_table_exists = $wpdb->get_var("SHOW TABLES LIKE '{$table_items}'") === $table_items; $meta_table_exists = $wpdb->get_var("SHOW TABLES LIKE '{$table_meta}'") === $table_meta; if (!$items_table_exists || !$meta_table_exists) { return 0; } // Grab individual line items for debugging $results = $wpdb->get_results($wpdb->prepare(" SELECT oim.meta_value AS qty, oi.order_item_id FROM {$table_items} AS oi INNER JOIN {$table_meta} AS oim ON oi.order_item_id = oim.order_item_id WHERE oi.order_id = %d AND oi.order_item_type = 'line_item' AND oim.meta_key = '_qty' ", $order_id)); if (empty($results)) { return 0; } foreach ($results as $row) { $qty = intval($row->qty); $total_qty += $qty; } return $total_qty; } public function log_message($data) { if (!function_exists('WP_Filesystem')) { require_once ABSPATH . 'wp-admin/includes/file.php'; } WP_Filesystem(); global $wp_filesystem; $plugin_dir = plugin_dir_path(__FILE__); $log_file = $plugin_dir . 'my_log.txt'; $current_time = current_time('Y-m-d H:i:s'); // Format the data appropriately if (is_array($data) || is_object($data)) { $formatted_data = print_r($data, true); } else { $formatted_data = (string)$data; } $log_entry = "[{$current_time}] {$formatted_data}\n"; if ($wp_filesystem->exists($log_file)) { $existing_content = $wp_filesystem->get_contents($log_file); $wp_filesystem->put_contents($log_file, $existing_content . $log_entry); } else { $wp_filesystem->put_contents($log_file, $log_entry); } } } // Initialize the plugin $export_stats = new Export_stats(); Spot the Early Signs of Hair Thinning: What to Look For
Free Shipping + 30 Day Money Back Guarantee

Magazine

What Are the First Signs of Hair Thinning?

author
Posted by

Brian Melville

Men are known to be more prone to hair loss and conditions that induce hair loss than women. In turn, by the time a man is in his 20s or 30s, it is common for him to become plagued with the fear of hair loss. 

Even though going gray and becoming a silver fox has been deemed sexy by the general population, balding has not yet received this same level of acceptance. Therefore, having a fear of losing your hair is both normal and completely understandable. 

To prevent your fear of going bald from coming to fruition, it is essential to identify what is causing it early on. 

Today, Particle will explain common causes of hair loss and easily identifiable signs that can get you on track to combat your hair loss as soon as possible.

What Are Potential Causes of Hair Thinning?

By finding the source of the issue, you can ideally develop an effective treatment plan to stop hair loss and support hair growth. 

Here are three of the most common causes of hair thinning.

Genetics

The most common reason men begin losing their hair is that hair loss or baldness may have run in their families. The formal term for male pattern baldness is androgenetic alopecia, affecting an estimated 50 million men in the United States.

With androgenetic alopecia, hair is lost in a well-defined pattern. Usually, the hair loss will begin above the temples, and thinning will occur near the top of the head or the crown. 

This can progress to complete baldness with time.

Genes for hair loss are passed down from both sides of the family. While everyone experiences some form of hair thinning with age, 40% of men will experience it to a noticeable degree. 

This hair loss will often begin when someone is in their 20s or 30s.

Many researchers believe that hair loss is closely related to the hormone androgen. Androgens are most known for their role in male sexual development, particularly during puberty. However, the hormone also plays a role in regulating hair growth.

Variations in the AR gene — which is responsible for explaining how to make a protein called an androgen receptor — can lead to increased activity of androgen receptors in hair follicles. These genetic changes are believed to play a role in androgenetic alopecia.

Medical Conditions

It is possible for any number of medical conditions to negatively impact your hair growth. Whether or not the hair loss is permanent will depend on the condition and its severity. There are even medical conditions that specifically involve the disruption of hair growth like alopecia areata

Hair growth relies on the production of protein cells at the root of the follicle. When the follicle is attacked, this process becomes disrupted, and hair will not grow, resulting in eventual baldness.

Most commonly, the baldness will first appear as an oval patch on the top of the scalp. However, this condition affects all hair follicles meaning that hair loss may occur on any area of the body containing hair follicles.

Aside from alopecia areata, any medical condition that triggers a hormonal imbalance is likely to affect hair growth. Since hormones regulate functions in the body that include hair growth, hair loss can result in hair loss. 

Additionally, there is a chance that your medical condition is not causing your hair loss but rather the medication that you are using to treat it. 

Hair loss is a common side effect of certain medicines and supplements.

Stress

Stress is a leading cause of hair loss, though it does not always present itself in the way people might expect. Stress-induced hair loss does not occur immediately. Rather, the thinning of your hair will typically begin to occur two to three months following a traumatic event.

This form of hair loss is called telogen effluvium

Telogen effluvium occurs after you have experienced a significantly stressful event. As a response to the intense feeling of stress, your body will begin to redirect some of its energy to the parts of the body that keep you alive and functioning. 

One of the sources from which the body will take some of this energy that it needs for your heart and brain will be the energy typically directed towards hair growth.

This interruption to the growth cycle will result in hair follicles entering a resting state and a lack of hair growth that becomes visible within a few months’ time. The hair loss will be particularly noticeable when performing actions that include showering or combing your hair.

Four Signs of Hair Loss

While there are methods for treating hair loss at any stage, identifying the issue early on will help stop the problem faster and prevent your hair from thinning any more than it has to. 

Here are four signs to look out for that indicate that you are beginning to lose your hair.

Clumps of Hair

Every day regardless of age and gender, every person loses some hair strands. While this is entirely normal and natural, losing full chunks of hair at one time is not. Perhaps the most apparent sign of issues with your hair growth cycle is the sudden loss of big pieces of hair.

Please note that losing a considerable amount of hair while showering is not uncommon for men with long hair. The important thing is that you notice a substantial change. If you are losing a far greater amount of hair than usual, this is signaling to you that you are beginning to lose your hair and that, without treatment, you are on the road to baldness.

Receding Hairline

The most common and arguably sneakiest way you may begin to lose your hair is through gradual thinning. Hair will typically start to thin at the temples or on the crown of a man’s head. This is particularly common with genetic baldness.

Look out for the appearance of a receding hairline. 

With your hair slowly thinning in these areas, your hairline is going to gradually rise up onto your forehead and onto your scalp. If your forehead has been appearing a little bigger than usual, you may want to check to see if you are starting to lose hair.

Bald Spots

Probably the most stereotypical sign of hair loss is bald spots. It is a stereotype for a reason — because it occurs often. As your body attacks your hair follicles, patches of hair may begin to fall out, resulting in bald spots.

One of the most direct ways to determine if your bald spots are a direct result of hair loss rather than a temporary cause is if the patches are circular. On occasion, these spots may feel itchy both before and after the hair has fallen out, and the areas of skin can begin to scale.

Loss of Body Hair

If you notice that the top of your head is not the only place that is beginning to lose hair, you definitely have a hair loss issue involving the health of your hair follicles. We have an estimated five million hair follicles located on our bodies from head to toe. 

When something disrupts the hair growth cycle and harms your hair follicles, it is likely to be visible in more than one area of your body. Look out for hair loss in other areas outside of your scalp, like the hair on your face. 

Thinning eyebrows and eyelashes should be enough to warrant a visit to a dermatologist or physician.

Conclusion

In most cases, losing your hair is natural. But regardless of the cause, your hair loss does not have to be permanent. The important thing is that you identify your hair loss early on and then figure out what the cause is as soon as possible. 

Be observant of signs like receding hair loss, bald spots, and the thinning of hair anywhere on your body. 

Once you know that the growth of your hair is being interrupted, you can figure out whether your particular hair loss is caused by genetics, a medical condition, your medication, or even stress from life circumstances.

Discovering the source of your hair thinning or loss will allow you to develop the appropriate treatment plan. Something that should be a part of your treatment plan, no matter what is behind your hair loss, is strengthening and rejuvenating your hair back to health.

Convenient bundles like the Particle Revival Kit make this easy. Our highly reviewed product used once every three days makes it simple for you to fight hair loss, increase hair thickness, energize the scalp, and toughen your hair follicles.

With a bit of observance and action, you will be able to continue to find security in a thick head of hair.

So what are you waiting for? Time to have your hair back. 

 

Sources:

Androgenetic alopecia | MedlinePlus  

Hair loss types: Alopecia areata overview | American Academy of Dermatology (AAD)

Telogen Effluvium Hair Loss | American Osteopathic College of Dermatology (AOCD)