Skip to content

Instantly share code, notes, and snippets.

View tsarouxas's full-sized avatar

George Tsarouxas tsarouxas

View GitHub Profile
@tsarouxas
tsarouxas / wpml-woocommerce-cheatsheet.php
Last active October 7, 2025 11:12
WPML Woocommerce Cheatsheet
<?php
//Get default Site Language
$defaultLanguageCode = apply_filters('wpml_default_language', null);
//Get Product Language**
$productLanguageCode = apply_filters('wpml_element_language_code', null, ['element_id' => $productId, 'element_type' => 'product']);
//Get Product translation
$translationEnId = apply_filters('wpml_object_id', $productId, 'product', false, 'en');
@tsarouxas
tsarouxas / whatissoslow.php
Created March 19, 2025 10:22 — forked from Viper007Bond/whatissoslow.php
WordPress: Times how long it takes each filter and action to run and displays results at the end of the page. Quick and dirty.
<?php
/**
* This little class records how long it takes each WordPress action or filter
* to execute which gives a good indicator of what hooks are being slow.
* You can then debug those hooks to see what hooked functions are causing problems.
*
* This class does NOT time the core WordPress code that is being run between hooks.
* You could use similar code to this that doesn't have an end processor to do that.
*
@tsarouxas
tsarouxas / plesk-setup.sh
Last active February 18, 2025 15:48
Plesk reseller shell setup
#!/bin/bash
#wp-cli local bin
mkdir -p ~/.local/bin &&
cd ~/.local/bin &&
curl -OL -k https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar &&
chmod +x wp-cli.phar &&
mv wp-cli.phar wp &&
echo 'PHP_VERSION="php82"' >> ~/.bashrc &&
@tsarouxas
tsarouxas / install-wp.sh
Created December 11, 2024 18:08 — forked from BFTrick/install-wp.sh
Download & Install WordPress via Curl
curl -O https://wordpress.org/latest.zip
unzip latest.zip
mv wordpress site
rm latest.zip
@tsarouxas
tsarouxas / nginx-tuning.md
Created November 29, 2024 05:40 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@tsarouxas
tsarouxas / migrate-woocommerce-orders.php
Last active February 17, 2024 19:08 — forked from cfaria/migrateorders.php
Migrate WooCommerce Orders
<?php
//increase max execution time of this script to 150 min:
ini_set('max_execution_time', 9000);
//increase Allowed Memory Size of this script:
ini_set('memory_limit','960M');
/*
#Migrate Woocommerce Ordersmysqldump -u db_user -p db_name > old.sql
@tsarouxas
tsarouxas / ebay-sdk-list
Created October 3, 2023 13:22
ebay-sdk-list
https://github.com/0605/ebay-sdk-php/blob/master/src/Inventory/Services/InventoryService.php
https://github.com/4c/ebay-sdk-php/blob/master/src/Inventory/Services/InventoryService.php
https://github.com/AaronKaa/ebay-sdk-php/blob/master/src/Inventory/Services/InventoryService.php
https://github.com/abedham/ebay-sdk-php/blob/master/src/Inventory/Services/InventoryService.php
https://github.com/AceParts/ebay-sdk-php/blob/master/src/Inventory/Services/InventoryService.php
https://github.com/adamtoms/ebay-sdk-php/blob/master/src/Inventory/Services/InventoryService.php
https://github.com/aigletter/ebay-sdk-php/blob/master/src/Inventory/Services/InventoryService.php
https://github.com/akshayadixit/ebay-sdk-php/blob/master/src/Inventory/Services/InventoryService.php
https://github.com/aldorac337/ebay-sdk-php/blob/master/src/Inventory/Services/InventoryService.php
https://github.com/alexugg/ebay-sdk-php/blob/master/src/Inventory/Services/InventoryService.php
define('WP_DEBUG',false);
define('WP_DEBUG_LOG',false);
define('WP_DEBUG_DISPLAY',false);
define('SAVEQUERIES', false);
define('FS_METHOD','direct');
define('EMPTY_TRASH_DAYS',1);
define('WP_HOME', 'https://client.com');
define('WP_SITEURL', 'https://client.com');
define('DISABLE_WP_CRON', true);
define('WP_POST_REVISIONS', false);
@tsarouxas
tsarouxas / delete-cpt-entries.sql
Created July 7, 2023 12:27 — forked from gregghenry/delete-cpt-entries.sql
Delete Custom Post Type and Post Meta via MySQL
# You made a backup right? Ok....
# I needed this because I had over 100k posts in a CPT and deleting was a pain.
# This doesn't take into account any categories or revisions, so keep that in mind. You can use a plugin to clean those up or edit this to your liking.
# The first select statement you can run to determine if you have the correct records you want to delete.
# Change 'custompost' to whatever your custom post type is called.
SELECT DISTINCT ID, post_title, post_type, post_status
FROM wp_posts a
LEFT JOIN wp_postmeta b ON ( a.ID = b.post_id )
WHERE a.post_type = 'custompost'
{
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 50000,
"proseWrap": "preserve",
"quoteProps": "as-needed",