Skip to content

Instantly share code, notes, and snippets.

View WProbot's full-sized avatar
💭
I may be slow to respond.

Lukács József WProbot

💭
I may be slow to respond.
View GitHub Profile
<?php
add_action( 'setted_transient', 'fix_wc_product_loop_transient', 50, 3 );
function fix_wc_product_loop_transient( $transient, $value, $expiration ){
$pos = strpos( $transient, 'wc_product_loop_' );
if ( $pos !== false && $expiration == 2592000 ) {
set_transient( $transient, $value, DAY_IN_SECONDS );
}
}
#!/bin/bash
#
# woo-customer-email.sh
#
wp user list | gawk '
BEGIN {
FS = OFS = "\t";
}
#!/bin/bash
#
# woo-order-email.sh
#
wp db dump - --tables=$(wp db prefix)postmeta \
--skip-extended-insert | gawk '
/ing_email/ {
gsub(".[)];.*$", "");
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(wp-content/uploads/20[0-9][0-9]/.*)$
RewriteRule ^(.*) https://prod-domain.tld/%1 [L,R=302]
</IfModule>
#!/bin/bash
#
# ide kerül => /etc/cron.weekly/callsign-weekly
#
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
OD=/netpub/wwwroot/breko.hu/callsign
OF=call_sign_book.csv
@WProbot
WProbot / clinup
Created November 28, 2021 06:00 — forked from petskratt/clinup
Use wp-cli to clean up WordPress installs (force core & plugins reinstall, track changes in git allowing easy reverts etc)
#!/usr/bin/env bash
# for debug output, uncomment:
#set -x
function help {
echo "WordPress cleanup -v 0.5 2018-06-26 / peeter@zone.ee
Usage:
@WProbot
WProbot / cc-wc-orders-controller
Last active November 25, 2021 03:56 — forked from LosArtos/cc-wc-orders-controller
orders-controller
<?php
if (!defined('ABSPATH')) {
exit;
}
class CC_WC_Orders_Controller
{
public function Init()
{
function remove_category( $string, $type ) {
if ( $type != 'single' && $type == 'category' && ( strpos( $string, 'category' ) !== false ) ) {
$url_without_category = str_replace( "/category/", "/", $string );
return trailingslashit( $url_without_category );
}
return $string;
}
add_filter( 'user_trailingslashit', 'remove_category', 100, 2);
BEGIN {
FS = "\t";
getline;
}
/[/]images[/]/ {
next;
}
@WProbot
WProbot / import-optimizations.md
Created April 20, 2021 20:14 — forked from trey8611/import-optimizations.md
WP All Import - Optimize your import speed.