WordPress

A numerology calculator for WordPress

Put a life path calculator on your WordPress site without trusting a plugin's maths. A short shortcode calls the numerology API from your server, keeps your key private, and caches every result.

The shortcode

Add this to a small custom plugin or your theme’s functions.php, and define NUMEROLOGY_API_KEY in wp-config.php:

add_shortcode('numerology_calculator', function () {
    $html = '<form method="post">'
        . '<input name="first_name" placeholder="First name" required> '
        . '<input name="last_name" placeholder="Last name" required> '
        . '<input name="birthdate" type="date" required> '
        . wp_nonce_field('numerology', '_wpnonce', true, false)
        . '<button>Calculate</button></form>';

    if (empty($_POST['birthdate']) || !wp_verify_nonce($_POST['_wpnonce'] ?? '', 'numerology')) {
        return $html;
    }
    $person = [
        'first_name' => sanitize_text_field(wp_unslash($_POST['first_name'])),
        'last_name' => sanitize_text_field(wp_unslash($_POST['last_name'])),
        'birthdate' => sanitize_text_field(wp_unslash($_POST['birthdate'])),
    ];
    $cache_key = 'numerology_' . md5(implode('|', $person));
    $chart = get_transient($cache_key);
    if ($chart === false) {
        $response = wp_remote_post('https://simplenumerologyapi.com/v1/charts/pythagorean', [
            'headers' => ['X-API-Key' => NUMEROLOGY_API_KEY, 'Content-Type' => 'application/json'],
            'body' => wp_json_encode($person),
            'timeout' => 10,
        ]);
        if (is_wp_error($response) || wp_remote_retrieve_response_code($response) !== 200) {
            return $html . '<p>The calculator is busy. Please try again later.</p>';
        }
        $chart = json_decode(wp_remote_retrieve_body($response), true);
        set_transient($cache_key, $chart, MONTH_IN_SECONDS);
    }
    return $html . sprintf(
        '<p>Life path <strong>%d</strong> · Destiny <strong>%d</strong> · Soul urge <strong>%d</strong></p>',
        $chart['life_path_number'], $chart['destiny_number'], $chart['soul_urge_number']
    );
});

Then put [numerology_calculator] on any page or post.

Why call an API instead of a plugin’s own code

Most numerology plugins hard-code one reading of the rules, and many get the details wrong: master numbers reduced away, the life path summed digit by digit, Y counted inconsistently. The API applies documented conventions covered by golden tests, so your visitors get the same number a professional numerologist would.

You also get every other number from the same response: soul urge, personality, karmic debts, pinnacles. Show more of them as your calculator grows, without new code for the maths.

Keep the key on the server

The request goes from WordPress to the API, never from the visitor’s browser. Your key never appears in the page source, and the API does not accept cross-origin browser calls anyway.

Mind the quota

Every new name and birthdate costs one request; repeats come from the transient cache. The free plan’s 100 requests a month suits a small blog. If the calculator is your most popular page, Starter gives you 10,000 for $9 a month. When the quota runs out the API returns 402 and the shortcode shows its fallback message, so nothing breaks.

Frequently asked questions

Is there a free numerology calculator for WordPress?

The shortcode on this page is free to use, and the API’s free plan includes 100 calculations a month with no card. Repeat visitors are served from the cache and use no requests.

Can I put the calculator in a page builder like Elementor?

Yes. Every major page builder has a shortcode block or widget. Add one and enter the shortcode.

Will the calculator slow down my site?

Only the page view that submits the form calls the API, and the computation takes well under a millisecond. Cached results are read from the WordPress database.

Can visitors see my API key?

No. The key is defined in wp-config.php and used only in the server-side request, so it never reaches the browser.

Start with 100 free charts a month

No card, no trial clock, no expiry date.

Get a free key

Related