How to Build a Bitcoin Donation Shortcode for WordPress
Save the PHP file as a small plugin with a Plugin Name header, activate it in a staging WordPress installation and insert [bitcoin_donate] in a Shortcode block. Replace the placeholder URL with your HTTPS donation page. The callback returns markup rather than printing it. The fixed URL avoids arbitrary shortcode-supplied destinations.
Source code
1<?php
2function stage25_donation_shortcode(): string {
3 return '<a href="https://example.org/donate">Donate Bitcoin</a>';
4}
5if (function_exists('add_shortcode')) {
6 add_shortcode('bitcoin_donate', 'stage25_donation_shortcode');
7}
8if (PHP_SAPI === 'cli' && !str_contains(stage25_donation_shortcode(), 'https://example.org/donate')) exit(1);Validation and deployment
Use a staging site and testnet first. Verify the destination, test duplicate payment notifications and keep fulfillment separate from browser requests. This example was checked locally, not inside a live CMS.
Related documentation
https://thamer.org/api
