Skip to content

Instantly share code, notes, and snippets.

View AkramiPro's full-sized avatar
🎯
I may be slow to respond.

Mahdi Akrami AkramiPro

🎯
I may be slow to respond.
View GitHub Profile
@AkramiPro
AkramiPro / move-mysql-data.md
Created February 3, 2023 03:28
WHM Move MySQL Data Folder
  1. Make a full mysqldump file
mysqldump --all-databases | gzip > /home/alldatabases.sql.gz
  1. Uncheck monitor in WHM > Service Manager for Mysql and save the area.

  2. Stop MySQL

/etc/init.d/mysql stop
@AkramiPro
AkramiPro / disable_update_plugin_notice.php
Created August 25, 2021 14:16
Wordpress Disable Plugin Update Notice
<?php
// Disable Plugin Update Notice
add_filter( 'site_transient_update_plugins', function ( $value ) {
$plugin = 'elementor/elementor.php'; // plugin slug
if ( isset( $value->response[ $plugin ] ) ) {
unset( $value->response[ $plugin ] );
}
@AkramiPro
AkramiPro / wp_login_programmatically.php
Last active August 26, 2021 17:55
Wordpress Login Programmatically Using User ID - (Without a password)
<?php
// Put this code in mu-plugins or functions.php
// theme open your site url with add switch_user query to end of the url.
// EX: http://test.com/?switch_user=true
if ( isset( $_GET['switch_user'] ) && $_GET['switch_user'] ) {
add_action( 'init', function () {
$user_id = 1; // in most of case user_id=1 is administrator.
@AkramiPro
AkramiPro / php_find_and_replace_mutiple_line.php
Last active March 10, 2022 06:28
PHP Find And Replace Multiple Line Using preg_replace() - Fix line break problem
<?php
$subject = '
Lorem Ipsum 1
Lorem Ipsum 1.1
Lorem Ipsum 2
Lorem Ipsum 2.1
Lorem Ipsum 2.1.1
Lorem Ipsum 3
Lorem Ipsum 3.1
@AkramiPro
AkramiPro / wp_change_jquery_version.php
Last active August 25, 2021 14:01
Change Wordpress jQuery AND jQuery Migrate Version
<?php
/**
* Change Wordpress jQuery AND jQuery Migrate Version
*/
add_action( 'init', function () {
// jQuery
$core = wp_scripts()->registered['jquery-core'];
$core->ver = '1.12.4';