Skip to content

Instantly share code, notes, and snippets.

View nunomorgadinho's full-sized avatar

Nuno Morgadinho nunomorgadinho

View GitHub Profile
@nunomorgadinho
nunomorgadinho / gist:108c74d8a4ca54b670e0c47366e60d7d
Created June 7, 2021 13:30
Export and import a subsite into multisite
# Install 10up/mu-migration
wp package install 10up/mu-migration
# Command to export
wp mu-migration export all subsite.zip --blog_id=1
# Command to import
wp mu-migration import all subsite.zip --new_url=3316b88deb.nxcli.net/dk-0037 --mysql-single-transaction
# Additional steps
@nunomorgadinho
nunomorgadinho / console
Created May 13, 2021 23:39
Temporarily disable all active plugins and the re-enable them
wp plugin list --status=active --format=csv --field=name > plugins.txt
chomd +x enable_plugins.sh
./enable_plugins.sh plugins.txt
@nunomorgadinho
nunomorgadinho / archive_historial_orders.sql
Created April 23, 2021 08:08
SQL query to remove old orders in WooCommerce
DELETE
FROM wp_woocommerce_order_itemmeta
WHERE order_item_id IN (
SELECT order_item_id
FROM wp_woocommerce_order_items
WHERE order_id IN (
SELECT ID
FROM wp_posts
WHERE post_date < '2017-01-01'
)
{
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
}
],
"require": {
"wpackagist-plugin/wordpress-seo":"*"
},
wp plugin install stop-xmlrpc-attack --activate
wp plugin install http-security --activate
<?php
/**
* The template for displaying single posts and pages.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package WordPress
* @subpackage Twenty_Twenty
* @since Twenty Twenty 1.0
*/
a {
text-decoration: underline overline dotted red;
}
@nunomorgadinho
nunomorgadinho / mysql
Last active September 27, 2019 13:48
setup new country
#create db user
CREATE USER 'idealbiz_za'@'localhost' IDENTIFIED BY '<PASSWORD>';
GRANT ALL PRIVILEGES ON idealbiz_za.* TO 'idealbiz_za'@'localhost' WITH GRANT OPTION;
flush privileges;
#mysql db import
mysql -u idealbiz_za -p'<PASSWORD>' idealbiz_za < idealbiz_fr_dump.sql
# to allow login and recover pass by the tech user
update wp_users set user_login="<EMAIL>" where user_login="<EMAIL>";
/*
Welcome to Custom CSS!
CSS (Cascading Style Sheets) is a kind of code that tells the browser how
to render a web page. You may delete these comments and get started with
your customizations.
By default, your stylesheet will be loaded after the theme stylesheets,
which means that your rules can take precedence and override the theme CSS
rules. Just write here what you want to change, you don't need to copy all
@nunomorgadinho
nunomorgadinho / macos-setup.md
Last active February 15, 2021 16:01
Clean Install – macOS

macOS

Custom recipe to get macOS running from scratch, setup applications and (WordPress) developer environment. I use this gist to keep the steps required to have a functioning system after a semi-annual fresh install.

Software

Browsers

System