TUTORIAL

Build a WordPress Astrology Plugin with Vedika API

Create a WordPress plugin that adds astrology features to any site. Daily horoscope widget, birth chart generator, and compatibility checker.

March 6, 2026 - 12 min read

Plugin Structure

This WordPress plugin adds three shortcodes: [vedika_horoscope] for daily horoscope, [vedika_birth_chart] for birth chart generator, and [vedika_compatibility] for kundali matching. Each shortcode renders a widget that calls Vedika API via AJAX.

// vedika-astrology/vedika-astrology.php
/*
Plugin Name: Vedika Astrology
Description: Add astrology features powered by Vedika API
Version: 1.0.0
*/

define('VEDIKA_API_URL', 'https://api.vedika.io');

// Register shortcodes
add_shortcode('vedika_horoscope', 'vedika_horoscope_shortcode');
add_shortcode('vedika_birth_chart', 'vedika_birth_chart_shortcode');

function vedika_horoscope_shortcode($atts) {
    $atts = shortcode_atts(['sign' => 'aries'], $atts);
    wp_enqueue_script('vedika-widget', plugin_dir_url(__FILE__) . 'js/widget.js');
    return '
'; } // AJAX handler for API calls add_action('wp_ajax_vedika_api_call', 'vedika_api_handler'); add_action('wp_ajax_nopriv_vedika_api_call', 'vedika_api_handler'); function vedika_api_handler() { $api_key = get_option('vedika_api_key'); $endpoint = sanitize_text_field($_POST['endpoint']); $body = json_decode(stripslashes($_POST['body']), true); $response = wp_remote_post(VEDIKA_API_URL . $endpoint, [ 'headers' => [ 'X-API-Key' => $api_key, 'Content-Type' => 'application/json' ], 'body' => json_encode($body), 'timeout' => 30 ]); wp_send_json(json_decode(wp_remote_retrieve_body($response))); }

Settings Page

Add a settings page under Settings → Vedika Astrology where site admins enter their API key. The API key is stored securely in WordPress options table and never exposed to the frontend — all API calls go through the AJAX handler on your server.

Revenue Opportunities

Astrology plugins are highly monetizable. Charge a premium for advanced features (detailed birth chart, AI chat), offer it as a SaaS plugin with monthly billing, or use it to drive traffic to your main astrology service. The Vedika API pay-per-use model means you only pay for actual usage.

Ready to integrate astrology into your app?

Start with our free sandbox — no API key required.

Try Sandbox Free