Skip to content

Instantly share code, notes, and snippets.

@homu9
homu9 / bulk-delete-wordpress-thumbnails.php
Created April 28, 2024 02:26
Bulk delete WordPress thumbnails
<?php
require_once('./wp-load.php');
$per_page = 5000;
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$args = array(
'post_type' => 'attachment',
'post_status' => 'inherit',
'posts_per_page' => $per_page,
#!/bin/bash
# Change directory to /home
cd /home
# Iterate through all users directories
for user in * ; do
# For every webapp under the user directory
# Count wp-config files to make sure its Wordpess
@homu9
homu9 / buy-now.php
Last active November 11, 2022 02:25
Add 'Buy Now' button to WooCommerce Single Product Page
function custom_wc_add_buy_now_button_single_before() {
echo '<div id="cart-action-wrapper">';
}
add_action( 'woocommerce_before_add_to_cart_button', 'custom_wc_add_buy_now_button_single_before' );
function custom_wc_add_buy_now_button_single_after()
{
global $product;
$current_product_id = get_the_ID();
$product = wc_get_product( $current_product_id );
$checkout_url = WC()->cart->get_checkout_url();
@homu9
homu9 / gist:7d68b59aeb24c6f02455b776263041a2
Created April 13, 2022 19:54
Bulk update plugins for runcloud
#!/bin/bash
# Change directory to /home
cd /home
# Iterate through all users directories
for user in * ; do
# For every webapp under the user directory
# Count wp-config files to make sure its Wordpess