This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Update these four constants in wp-config.php on your new server | |
| // Replace with the credentials from your new host's MySQL database setup | |
| define( 'DB_NAME', 'new_database_name' ); | |
| define( 'DB_USER', 'new_database_user' ); | |
| define( 'DB_PASSWORD', 'new_database_password' ); | |
| define( 'DB_HOST', 'localhost' ); // Usually 'localhost' — check with your new host |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; php.ini — PHP process memory ceiling | |
| ; This is the absolute maximum PHP will allocate for any script. | |
| ; WordPress and all plugins combined cannot exceed this value. | |
| memory_limit = 256M | |
| ; For memory-intensive operations (large imports, WooCommerce batch processing): | |
| ; memory_limit = 512M | |
| ; For shared hosting where you cannot edit php.ini directly, | |
| ; use .htaccess (Apache only): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Register a custom EDD report using the Reports API. | |
| * | |
| * Hook into 'edd_reports_init' to add your own report endpoint, | |
| * define its date filters, and register the data tile(s) it contains. | |
| * | |
| * @package EDD_Custom_Reports | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Find autoloaded options bloating your wp_options table | |
| -- Run in phpMyAdmin, TablePlus, or via WP-CLI: wp db query < 01-check-autoload-options.sql | |
| -- 1. Total size of autoloaded data (in MB) | |
| SELECT | |
| ROUND(SUM(LENGTH(option_value)) / 1024 / 1024, 2) AS autoload_size_mb, | |
| COUNT(*) AS autoload_row_count | |
| FROM wp_options | |
| WHERE autoload = 'yes'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## nginx.conf — Page cache with WooCommerce cart/session exclusions | |
| ## Place inside your server {} block (or FastCGI Cache config) | |
| fastcgi_cache_path /tmp/nginx-cache levels=1:2 keys_zone=WORDPRESS:100m inactive=60m; | |
| fastcgi_cache_key "$scheme$request_method$host$request_uri"; | |
| server { | |
| # ... your existing server config ... | |
| set $skip_cache 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Register a custom point rule with WP Gamification. | |
| * | |
| * Hook: wp_gamification_register_rules | |
| * Fires on 'init' after the plugin has loaded its core rule engine. | |
| */ | |
| add_action( 'wp_gamification_register_rules', function( $rule_registry ) { | |
| $rule_registry->register( 'bp_profile_complete', [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Step 1: Create the plugin directory inside WordPress | |
| cd wp-content/plugins | |
| mkdir highlight-card-block | |
| cd highlight-card-block | |
| # Step 2: Initialise npm project | |
| npm init -y | |
| # Step 3: Install @wordpress/scripts as a dev dependency |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Schedule a custom cron event on plugin activation. | |
| * | |
| * Hooks into 'wp_schedule_event' to register a task that runs | |
| * once every hour starting from the current time. | |
| */ | |
| function myplugin_activate() { | |
| if ( ! wp_next_scheduled( 'myplugin_hourly_event' ) ) { | |
| wp_schedule_event( time(), 'hourly', 'myplugin_hourly_event' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Enable HPOS (High-Performance Order Storage) programmatically. | |
| * Place in a site-specific mu-plugin or functions.php. | |
| * Run AFTER the HPOS migration is complete. | |
| * | |
| * @see https://github.com/woocommerce/woocommerce/wiki/High-Performance-Order-Storage-Upgrade-Recipe-Book | |
| */ | |
| add_action( 'before_woocommerce_init', function () { | |
| if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { |
NewerOlder