| 开发者 | qeras89 |
|---|---|
| 更新时间 | 2026年10月2日 22:26 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
[metalflow_price metal="Gold" currency="EUR" unit="g"] — spot price for one metal
[metalflow_carat carat="14" currency="EUR" unit="g"] — carat-aware Gold price
[metalflow_ticker currency="EUR" unit="g" style="minimal"] — all 4 metals
[metalflow_table currency="EUR" unit="g"] — full carat table 9k–24k
[metalflow_change metal="Gold" days="30"] — % change over N days (Starter and above)
[metalflow_calc currency="EUR"] — interactive carat-weight calculator
[metalflow_chart metal="Gold" currency="EUR" range="1y" ranges="7d,1m,6m,1y,5y,max"] — interactive history chart with range buttons (paid plans)
Chart attributes
range — default range: 7d, 1m, 6m, 1y, 5y or max (default from Settings, normally 1y; older values such as 30d, 90d, 2y still work)ranges — which buttons to show, comma separated (default from Settings)metal, currency, unit (g, kg, ozt), height (80–600 px, default 220), fill="0" (no area fill), label="0" (hide title/price/change header)/wp-json/metalflowapi/v1/chart, which only serves charts that appear on your site, from the server-side cache).
Styling attributes (all shortcodes)
style — card, minimal or borderlesscolor (or accent) — accent / chart line colour, e.g. color="#b8860b"text, bg, border — text, background and border colours (hex)up, down — colours for rising / falling prices (hex)radius — corner radius in px (0–32)size — text size scale (0.75–1.5)[metalflow_ticker style="minimal" color="#b8860b"], [metalflow_chart range="1m" style="borderless" color="#2563eb" radius="12"]. Invalid values are ignored. Without attributes, widgets use Settings → MetalflowAPI → Appearance, and with that left empty they follow your theme.
Pricing
The plugin is 100% free. Prices come from the MetalflowAPI service, which has a free tier (no credit card required):
https://metalflowapi.com/api/v1/latest — spot prices (shortcodes metalflow_price, metalflow_ticker, the Live Price/Ticker blocks and the ticker widget)https://metalflowapi.com/api/v1/carat — gold carat prices (metalflow_carat, metalflow_table, metalflow_calc and the carat blocks)https://metalflowapi.com/api/v1/change — % change (metalflow_change)https://metalflowapi.com/api/v1/timeframe — daily prices for the 7D, 1M, 6M and 1Y chart ranges (metalflow_chart, Historical Chart block)https://metalflowapi.com/api/v1/sparkline — long-range price curve for the 5Y and Max chart ranges (also used if your plan does not include /timeframe)https://metalflowapi.com/api/v1/symbols — key check and currency list on the settings pageX-API-Key header), the query parameters needed for the widget (metal, currency, unit, date range, chart size/colour) and a User-Agent with the plugin and WordPress version numbers (it does not contain your site address). Your server's IP address is visible to the service, as with any HTTP request. Nothing about your visitors (IP addresses, cookies, behaviour), posts, comments or users is sent.
Optional in-dashboard registration (Settings → MetalflowAPI → "Get your free API key"). Only when you type your email address and click "Send code", the plugin sends that email address, this site's URL and the plugin version to https://metalflowapi.com/api/plugin/request-code. When you enter the 6-digit code it sends your email address and the code to https://metalflowapi.com/api/plugin/verify-code. This creates your free MetalflowAPI account and returns your API key, which is saved in your site's WordPress options.
Optional "Powered by MetalflowAPI" bonus (off by default). Only after you tick "Show a 'Powered by MetalflowAPI' link…" in Settings → MetalflowAPI and save (or click "Register this site"), the plugin sends this site's address (home URL), the address of one public page of your site that shows a MetalflowAPI widget (if known), the plugin version and your API key (X-API-Key header) to https://metalflowapi.com/api/plugin/poweredby (POST). MetalflowAPI then loads that homepage/page — right away and about once a day — only to check that the "Prices by MetalflowAPI" link is there; on the Free plan a verified link raises your monthly limit to 2,000 requests and gives fresher prices. The settings page asks the same endpoint for the verification status (GET, at most every 10 minutes while you view the page). When you untick the option, the plugin asks the endpoint to delete the registration (DELETE). Nothing is sent while the option is off.
Chart ranges in the browser. When a visitor clicks a chart range button, the browser asks your own site (/wp-json/metalflowapi/v1/chart), not metalflowapi.com. That endpoint only accepts the metal/currency/unit combinations of charts rendered on your site (signed) and the six fixed ranges, answers from the server-side cache (one API request per range per cache period: at least 30 minutes for 7D/1M, 1 hour for 6M/1Y, 6 hours for 5Y/Max) and never exposes your API key.
Caching. Responses are cached on your server with WordPress transients: on the Free plan (delayed prices) for 6 hours (1 hour with an active "Powered by" bonus), on paid plans for the configured time (default 5 minutes, never shorter than the plan's own refresh interval). Errors are cached briefly (a quota error until the time given by the service), and the last successful response is kept so visitors see the last known price, with its date, while the service is unreachable.
Links. Links to metalflowapi.com in the WordPress admin (sign-up, pricing, dashboard) carry utm_* parameters and the plugin version so MetalflowAPI can see which plugin version a visit came from. Nothing is sent until you click such a link. The optional "Prices by MetalflowAPI" link on the public site is off by default; when you enable it, it is a plain link to metalflowapi.com (the gold price page of your default currency) without tracking parameters, shown once per page.
/wp-content/plugins/metalflowapi-live-precious-metals-prices/ or install it through the WordPress Plugins screen.[metalflow_ticker currency="EUR"].Not for a personal or non-commercial site: the Free plan (500 requests/month, delayed prices) works with the plugin, which caches Free-plan prices for 6 hours to stay within the quota. Commercial sites (shops, jewelers, dealers) need a paid plan under MetalflowAPI's terms; Starter (€9/mo) also gives fresher prices and the change widget. Settings → MetalflowAPI shows your plan and monthly usage.
An optional deal, off by default: tick "Show a 'Powered by MetalflowAPI' link under widgets…" in Settings → MetalflowAPI and the plugin prints one small "Prices by MetalflowAPI" link per page, under the first widget. Your site is registered with MetalflowAPI, which checks your homepage (or the first public page that shows a widget) for the link right away and then daily. While the link is found, the Free plan gets 2,000 requests/month instead of 500 and fresher prices; the settings page shows the status (pending, verified, link not found). If the link is missing on two checks in a row, the bonus ends. Paid plans can show the link too, but don't need the bonus. Untick the option to remove the link and the registration at any time.
Visitors keep seeing the last known prices, labelled "as of ", and the plugin stops calling the API until the time given by the service, so pages stay fast. Administrators see a notice at 80% and 100% of the monthly quota (only on the Dashboard, Plugins and MetalflowAPI settings screens).
In your WordPress database (wp_options). Requests to MetalflowAPI are made from your WordPress server — the key is never sent to visitor browsers.
No. All API responses are cached server-side via WordPress transients (default 5 min, configurable). On a cache hit, response time is essentially zero.
Yes. Each site has its own settings and its own API key.
Visitors see nothing until a key is added. Logged-in editors see static sample data (labelled "Sample data · only you see this") so they can place and style widgets. The sample is built into the plugin — no network request is made and nothing is sent anywhere.
Not in v1.0. BTC/ETH support is on the roadmap for the MetalflowAPI service.
Yes. By default the widgets follow your theme. Settings → MetalflowAPI → Appearance sets a style preset (card, minimal, borderless), colours, corner radius and text size for all widgets, with a live preview. Each block has colour, typography, spacing and border controls plus a "Widget style" panel, and every shortcode accepts style, color, text, bg, border, up, down, radius and size. For full control, the widgets use CSS custom properties on the .mfapi-w wrapper (--mfapi-accent, --mfapi-text, --mfapi-bg, --mfapi-border, --mfapi-up, --mfapi-down, --mfapi-radius) and semantic class names (mfapi-price, mfapi-ticker, mfapi-chart, …).
Ranges longer than your plan's history are hidden from visitors (Free: 30 days — the chart itself needs a paid plan; Starter: 5 years; Pro: 30 years; Max is the full archive back to 1968). Logged-in administrators see these buttons with a lock and a link to the plans.
https://metalflowapi.com/api/plugin/poweredby; disabling it removes the registration (see External services). Settings → MetalflowAPI shows the status: pending, verified (bonus active) or link not found, with a "Check status" button.X-RateLimit-Month-Limit), so the percentage is right with the bonus or custom limits; with the bonus active, Free-plan prices are cached for 1 hour instead of 6 hours.range= / ranges=), min/max price and start/end date axes, tooltip with date and price on hover, touch and arrow keys, responsive, accessible (real buttons with aria-pressed, text summary for screen readers). Small vanilla script, no external libraries./timeframe (daily prices), 5Y/Max from /sparkline. One API request per range, cached server-side with a plan-aware lifetime. The default range comes with the page; other ranges load on click through a strict, signed, cached endpoint on your own site (/wp-json/metalflowapi/v1/chart) that accepts only fixed values — it is not a proxy.style, color/accent, text, bg, border, up, down, radius, size (all values validated; invalid values are ignored).width attribute is no longer needed (the chart fills its container); old range values (30d, 90d, 2y, …) are mapped to the new ranges./wp-json/metalflowapi/v1/data (it let anyone use the site's API key and quota) and the /calc endpoint. The carat calculator now computes in the browser from prices rendered into the page, so it also works on sites with plain permalinks.unit= on /latest and /carat; prices are no longer converted client-side. Labels show the unit (e.g. "per gram").unit attribute for [metalflow_ticker], the Ticker block and the Ticker widget (defaults to the Default unit setting). The unit is part of the cache key./api/v1) so dashboard keys (mfk_live_*) from metalflowapi.com/dashboard/keys work correctly. Previous versions incorrectly called the internal WordPress REST API (/wp-json/metals/v1), which rejected dashboard keys with "Invalid API key".[metalflow_chart] shortcode + "Historical Chart" Gutenberg block — server-side SVG sparkline for any metal/currency, from 30 days up to the full 58-year archive. Light/dark theme, custom width/height, gradient fill, last-value label./wp-json/metalflowapi/v1/data and /calc.