Astrology Widget for WordPress: Official RoxyAPI Plugin
Add astrology widgets to WordPress with the official RoxyAPI plugin: install from WordPress.org, add your key, and drop shortcodes. No code required.
TL;DR
- The fastest way to add an astrology widget to WordPress is the official RoxyAPI plugin: install it from the WordPress.org directory under the slug
roxyapi, paste one API key, and drop a shortcode. No code. - The plugin ships a shortcode and a matching block for 164 plus endpoints across 12 spiritual domains, from daily horoscope to Vedic kundli, on a single key.
- Your key stays server side and is never sent to the browser, so
[roxy_horoscope sign="leo"]is safe to place on any public page. - Build this with the Astrology API in minutes, free to start.
An astrology widget for WordPress used to mean hand-writing PHP: register a shortcode, call an API, cache the response, sanitize the output. That still works, and this guide keeps a short section on it for developers. But there is now a faster path. The official RoxyAPI plugin is published on the WordPress.org plugin directory under the slug roxyapi, and it turns every reading into a block or a shortcode you paste into a page. WordPress runs about 40 percent of the public web, so it is the single biggest surface for a horoscope, natal chart, or Vedic kundli feature. This tutorial shows the modern no-code path first, then the manual code path for teams that want to call the endpoints directly. Both keep the API key server side, out of the browser.
How do I add an astrology widget to WordPress?
Install the official RoxyAPI plugin from the WordPress.org directory, then drop a shortcode such as [roxy_horoscope sign="leo"] into any post or page. The plugin registers a shortcode and a matching Gutenberg block for every reading, calls the service server side, and renders an interactive card. No theme edits, no custom PHP, no JavaScript. It works the moment you activate it, on a small free daily allowance.
Each shortcode maps to one endpoint on the Astrology API. Pass attributes for a fixed reading you control, or leave them off to render a visitor form. The same pattern covers all 12 domains: swap [roxy_horoscope] for [roxy_kundli] or [roxy_life_path] and the plugin still handles the call, the cache, and the chart. Total time from a blank site to a rendered horoscope card is a few minutes, and nothing you write ever exposes the key.
Ready to build this? Astrology API gives you 164 plus endpoints across 12 domains, remote MCP for agents, and accuracy verified against NASA JPL Horizons. See pricing.
How do I install the plugin and add my API key?
In WordPress admin, open Plugins, Add New, search for RoxyAPI, and click Install Now, then Activate. Open the RoxyAPI menu in the sidebar, paste your API key, click Save Changes, and use Test Connection to verify. That is the whole setup. The plugin also works before you add a key, on a small free daily allowance, so you can preview readings the moment it activates.
The four setup steps in order:
- In Plugins, Add New, search RoxyAPI, click Install Now, then Activate.
- Sign up on the pricing page and copy your API key.
- Open the RoxyAPI menu, paste the key, click Save Changes, then Test Connection.
- Add a block from the inserter or paste a shortcode into any page.
The plugin accepts both publishable (pk) and secret (sk) key formats. Every call runs server side in PHP through the X-API-Key header, so the key never reaches the browser and is encrypted at rest when stored in the database. Publishable keys with an origin allowlist are the browser-safe option for the copy-paste widgets, which you can paste outside WordPress with no plugin, but inside the plugin the key stays server side either way.
For production, define the key as a constant in wp-config.php, above the line that reads "stop editing":
define( 'ROXYAPI_KEY', 'your_roxyapi_key_here' );
When the constant is set, the plugin disables the settings field and the constant takes priority. This keeps the key out of the database entirely.
The WordPress integration guide is the canonical companion to this post, with every install detail and the full shortcode list.
Which astrology shortcodes can I drop into a page?
Every reading has a shortcode. Pass attributes for a fixed reading the site owner controls, or drop the shortcode bare to render a visitor form. The most common widgets a WordPress astrology site ships are the daily horoscope, the Western natal chart, the Vedic kundli, a tarot pull, and a numerology or Life Path reading. Match the attribute names exactly; the plugin validates and sanitizes each one before it calls the service.
| Shortcode | Renders | Key attributes |
|---|---|---|
[roxy_horoscope sign="leo"] | Daily horoscope card | sign, date, period (daily, weekly, monthly) |
[roxy_natal_chart birth_date="1990-05-15" birth_time="14:30" lat="40.7128" lon="-74.0060" tz="America/New_York"] | Western natal wheel | birth_date, birth_time, lat, lon, tz |
[roxy_kundli birth_date="1990-05-15" birth_time="14:30" lat="28.6139" lon="77.2090" tz="Asia/Kolkata"] | Vedic kundli chart | birth_date, birth_time, lat, lon, tz |
[roxy_tarot_card spread="three" question="What should I focus on this week"] | Tarot pull | spread, question |
[roxy_numerology name="Ada Lovelace" birth_date="1815-12-10"] | Numerology core numbers | name, birth_date |
[roxy_life_path birth_date="1990-05-15"] | Life Path number | birth_date |
[roxy_angel_number number="1111"] | Angel number meaning | number |
[roxy_biorhythm birth_date="1990-05-15" target_date="today"] | Biorhythm cycles | birth_date, target_date |
[roxy_moon_phase] | Current moon phase | none |
Add a lang attribute to translate any reading, for example [roxy_horoscope sign="leo" lang="es"], across English, German, Hindi, Spanish, Turkish, Portuguese, French, and Russian. Two person readings such as [roxy_synastry], [roxy_gun_milan], and [roxy_compatibility] always render a form for both people, so they take no attributes. Browse the request and response for every endpoint in the API reference.
How do visitor forms and multi-domain readings work?
Drop any hero shortcode with no attributes and the plugin renders an accessible form with a city search that fills the coordinates automatically. On submit it validates the input, applies a per-IP rate limit and a consent checkbox, calls the service server side, and renders the result on the same page. The API key never reaches the browser at any step, so visitor forms are safe on a fully public page.
The same shortcode system reaches beyond Western astrology into Vedic astrology, numerology, tarot, human design, forecasts, biorhythm, I Ching, crystals, dreams, and angel numbers. A human design bodygraph is [roxy_generate_bodygraph date="1990-07-15" time="13:00:00" timezone="UTC" latitude="40.7128" longitude="-74.0060"] and a cross-domain forecast digest is [roxy_generate_digest]. Charts render as interactive SVG that follows the visitor light or dark theme, and server side caching with a per endpoint TTL keeps repeat page views off your quota. If you want the same charts in a custom theme, the drop-in UI components render the API response directly, and the open starter templates are a clone-and-ship head start.
Can I still call the RoxyAPI endpoints directly without the plugin?
Yes. If you are building your own theme or plugin and prefer code, store the key as a constant in wp-config.php, call any endpoint with wp_remote_get or wp_remote_post, and cache the response with a WordPress transient. This is the manual pattern the official plugin automates. It is the right choice when you need custom markup, a bespoke workflow, or a data shape the shortcodes do not surface.
Wrap every call in get_transient and set_transient. Daily content does not change within the day, so an hour long transient saves repeat calls and keeps rate-limit headroom for the chart endpoints that actually cost compute.
<?php
add_shortcode( 'my_horoscope', function ( $atts ) {
$atts = shortcode_atts( array( 'sign' => 'aries' ), $atts );
$sign = sanitize_key( $atts['sign'] );
$cache_key = 'my_horoscope_' . $sign;
$cached = get_transient( $cache_key );
if ( false !== $cached ) {
return $cached;
}
$response = wp_remote_get(
'https://roxyapi.com/api/v2/astrology/horoscope/' . $sign . '/daily',
array( 'headers' => array( 'X-API-Key' => ROXY_API_KEY ), 'timeout' => 10 )
);
if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
return '<p>Horoscope unavailable.</p>';
}
$data = json_decode( wp_remote_retrieve_body( $response ), true );
$html = '<div class="my-horoscope"><h3>' . esc_html( $data['sign'] ) . '</h3>';
$html .= '<p>' . esc_html( $data['overview'] ) . '</p>';
$html .= '<p>Lucky number ' . intval( $data['luckyNumber'] ) . '.</p></div>';
set_transient( $cache_key, $html, HOUR_IN_SECONDS );
return $html;
} );
The daily horoscope endpoint is GET /astrology/horoscope/{sign}/daily and the response carries sign, overview, love, career, luckyNumber, luckyColor, moonPhase, and energyRating, among others. Field names are camelCase, so a lucky_number reference renders blank because the field is luckyNumber. For coordinate-dependent readings like natal charts, call GET /location/search?q={city} first to resolve a city into latitude, longitude, and an IANA timezone, then feed those into the chart request. The plugin does all of this for you; the manual path is for when you need the raw response.
FAQ
Is there an official astrology plugin for WordPress?
Yes. The official RoxyAPI plugin is on the WordPress.org plugin directory under the slug roxyapi. It adds daily horoscopes, natal charts, Vedic kundli, tarot, numerology, human design, and more as blocks and shortcodes. It renders readings on a free daily allowance the moment you activate it, and one API key unlocks 164 plus endpoints across 12 spiritual domains.
How do I add horoscopes to WordPress without writing code?
Install the RoxyAPI plugin from Plugins, Add New, activate it, and paste a shortcode like [roxy_horoscope sign="leo"] into any post or page. The plugin renders the reading as an interactive card with no theme edits and no JavaScript. Leave the attributes off, as in [roxy_horoscope], to render a visitor form so readers pick their own sign.
Is the RoxyAPI WordPress plugin free?
The plugin is free and GPL licensed, and it renders readings on a small free daily allowance with no account, so you can try it immediately. For production traffic, add an API key from a RoxyAPI plan, which removes the daily limit and covers every domain under one key. Plans and current pricing are on the pricing page.
How do I add a Vedic kundli to a WordPress page?
Drop [roxy_kundli birth_date="1990-05-15" birth_time="14:30" lat="28.6139" lon="77.2090" tz="Asia/Kolkata"] into a post or page, and the plugin renders an interactive kundli chart. Leave the attributes off to render a visitor form with a city search that fills the coordinates for your reader. The tz attribute accepts an IANA name such as Asia/Kolkata or decimal hours such as 5.5.
Where is my RoxyAPI key stored and is it safe?
Your key lives either in wp-config.php as the ROXYAPI_KEY constant or encrypted at rest in the WordPress database. Because the plugin calls the service server side in PHP through the X-API-Key header, the key never reaches the browser at any point. Storing it as the wp-config.php constant keeps it out of the database entirely and is the recommended setup for production.
Conclusion
WordPress is where the largest astrology, horoscope, and numerology audiences live, and the official RoxyAPI plugin makes shipping a widget a matter of one install and one shortcode. Install it from the WordPress.org directory, add your key, and every reading across 12 domains renders as a block or a shortcode with the key safely server side. Start with the Astrology API and pick a plan on the pricing page when you are ready for production traffic.