Skip to content

Instantly share code, notes, and snippets.

View andreik6v's full-sized avatar

Andrei Chira andreik6v

View GitHub Profile
#!/bin/bash
# enhance_backup_sync.sh
#
# cPFence Team | https://cpfence.app
#
# Description:
# This script synchronizes the Enhance backup server's /backups directory with a remote server
# for disaster recovery (backup mode) or restores data from the remote server to the local server (restore mode).
#
# Usage:
@andreik6v
andreik6v / gist:707601cc532def9492c8d6b913787649
Created April 29, 2025 19:42
hostbill translation file
{
"_meta": {
"target": "user",
"name": "Română",
"direction": "ltr",
"iso": "ro"
},
"affiliates": {
"Account": "Account",
"AffInvoiceStatusCannotChanged": "The status cannot be changed for selected affiliate invoices.",
@andreik6v
andreik6v / gist:fa7f4dffbd834a1692fa144dd684a998
Created November 5, 2024 10:48
How to fix a missing primary key in wp_options
SET @new_option_id := xxxxxxxxxxx;
UPDATE wp_options
SET option_id = (@new_option_id := @new_option_id + 1)
WHERE option_id IN (
SELECT option_id
FROM (
SELECT option_id
FROM wp_options
WHERE option_id = 0
GROUP BY option_id
@andreik6v
andreik6v / wp-config.php
Created May 4, 2024 14:18 — forked from ryanjbonnell/wp-config.php
WordPress Config: Use X-Forwarded-For HTTP Header to Get Visitor's Real IP Address
// Use X-Forwarded-For HTTP Header to Get Visitor's Real IP Address
if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
$http_x_headers = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] );
$_SERVER['REMOTE_ADDR'] = $http_x_headers[0];
}
@andreik6v
andreik6v / delete-generated-wp-images.sh
Created March 22, 2023 15:33 — forked from neverything/delete-generated-wp-images.sh
Sometimes you only want the original images and not the generated sizes <name-of-image>-150x150.png. This command deletes all the files with a certain pattern in the file name. See https://silvanhagen.com/wordpress-delete-generated-images/ for more details.
# List the files
find -E . -type f -regex ".*-[[:digit:]]{2,4}x[[:digit:]]{2,4}(@2x)?.(jpg|jpeg|png|eps|gif)"
# DANGER! Delete the files
find -E . -type f -regex ".*-[[:digit:]]{2,4}x[[:digit:]]{2,4}(@2x)?.(jpg|jpeg|png|eps|gif)" -delete
# If your OS doesn't support -E (tip from https://github.com/quasel)
find . -type f -regextype posix-extended -regex ".*-[[:digit:]]{2,4}x[[:digit:]]{2,4}(@2x)?.(jpg|jpeg|png|eps|gif)"
# Improved with the help of https://github.com/markhowellsmead
@andreik6v
andreik6v / README.md
Created March 20, 2023 18:07 — forked from hofmannsven/README.md
Storing WordPress files and database with WP-CLI on the server.

WordPress Backups with WP-CLI

# TO BE ADDED TO location.main-before
###################################################################################################
# Rocket-Nginx
#
# Rocket-Nginx is a NGINX configuration to speedup your WordPress
# website with the cache plugin WP-Rocket (http://wp-rocket.me)
#
# Author: Maxime Jobin
# URL: https://github.com/maximejobin/rocket-nginx
#
@andreik6v
andreik6v / hide-plugins-if-not-ID.php
Created September 2, 2021 22:44 — forked from wpmudev-sls/hide-plugins-if-not-ID.php
Hides specific menus from any users if they don't have the given ID
<?php
/**
* Plugin Name: Hide Plugins
* Plugin URI: https://premium.wpmudev.org/
* Description: Hides specific plugins from Admin Menus & Plugins List
* Version: 1.0.0
* Author: Konstantinos Xenos @ WPMUDEV
* Author URI: https://premium.wpmudev.org/
* License: GPLv2 or later
@andreik6v
andreik6v / genesis-homepage
Created August 17, 2019 07:00
business-homepage
//* Unregister widgets areas & layouts
unregister_sidebar( 'sidebar-alt' );
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
//* Register Home Slider widget area
genesis_register_sidebar( array(
'id' => 'home-slider',
@andreik6v
andreik6v / delete-cron
Created December 10, 2018 20:52
delete WP cron
SELECT * FROM `wp_options` WHERE option_name = 'cron'