This file contains 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 | |
/** | |
* Updates product prices. | |
* More about WP CLI scripts: | |
* https://wptheming.com/2021/05/wp-cli-scripts-and-woocommerce/ | |
* | |
* wp eval-file update-product-prices.php | |
*/ | |
$products = get_posts([ |
This file contains 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
function prefix_customizer_register( $wp_customize ) { | |
$wp_customize->add_panel( 'panel_id', array( | |
'priority' => 10, | |
'capability' => 'edit_theme_options', | |
'theme_supports' => '', | |
'title' => __( 'Example Panel', 'textdomain' ), | |
'description' => __( 'Description of what this panel does.', 'textdomain' ), | |
) ); |
This file contains 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 | |
/** | |
* High volume modifications to Action Scheduler. | |
* | |
* Adapted from https://github.com/woocommerce/action-scheduler-high-volume/ | |
* | |
* Increase Action Scheduler batch size, concurrency, timeout period, and claim action query | |
* ORDER BY to process large queues of actions more quickly on servers with more server resources. | |
* | |
* @package UniversalYums\ActionScheduler |
This file contains 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 | |
/** | |
* Workaround to load historic data if WP CLI is not installed. | |
* Update the $code variable to match the coupon code you want to update. | |
* | |
* This code can be loaded in a custom plugin or in your theme's functions.php file. | |
* | |
* A transient is used to prevent the data from being updated more than once, | |
* but this code should be removed as soon as it has run and the table is updated. | |
*/ |
This file contains 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 | |
/** | |
* Estimates the reading time for a given piece of $content. | |
* | |
* @param string $content Content to calculate read time for. | |
* @param int $wpm Estimated words per minute of reader. | |
* | |
* @returns int $time Esimated reading time. | |
*/ | |
function prefix_estimated_reading_time( $content = '', $wpm = 300 ) { |
This file contains 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 | |
/** | |
* This script will delete all `on-hold` subscriptions and their orders and users. | |
* It will delete all subscriptions based on IP. | |
* | |
* wp eval-file delete-fraud-activity-by-ip.php 127.0.0.1 | |
* | |
* Dry run: | |
* wp eval-file delete-fraud-activity-by-ip 127.0.0.1 dry | |
* |
This file contains 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 | |
/** | |
* Some meta data should not be copied to subscriptions or renewal orders. | |
*/ | |
namespace UniversalYums\Subscriptions; | |
class PreventMetaCopy { | |
/** |
This file contains 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 | |
namespace UniversalYums\Admin\Performance; | |
class OrdersList { | |
/** | |
* The single instance of the class. | |
*/ | |
protected static $instance; |
This file contains 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 | |
/** | |
* WP CLI script to schedule a sale for specific dates. | |
* | |
* To support scheduled sales to the hour/minute, use this free plugin: | |
* https://wordpress.org/plugins/precise-sales-for-woocommerce/ | |
* | |
* wp eval-file schedule-products-sale.php | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { |