wp-cli – search replace URL

wp search-replace --skip-columns=guid --skip-tables=wp_users,wp_usermeta 'original-domain.com' 'new-domain.com'

# or test/count first with --dry-run
wp search-replace --skip-columns=guid --skip-tables=wp_users,wp_usermeta 'original-domain.com' 'new-domain.com' --dry-run

WP UpdraftPlus – disable plugin on local

# wp-config.php
define( 'WP_ENVIRONMENT_TYPE', 'staging' );

# in a mu-plugin
	function( $go_ahead ) {
		return ( 'local' === wp_get_environment_type() );

wp – theme test all WYSWYG editor tags

<h1>Header one</h1>
<h2>Header two</h2>
<h3>Header three</h3>
<h4>Header four</h4>
<h5>Header five</h5>
<h6>Header six</h6>
<p>Single line blockquote:</p>
<p>Stay hungry. Stay foolish.</p>
<p>Multi line blockquote with a cite reference:</p>
<blockquote cite="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote">
<p>The <strong>HTML <code><blockquote></code> Element</strong> (or <em>HTML Block Quotation Element</em>) indicates that the enclosed text is an extended quotation. Usually, this is rendered visually by indentation (see <a href="https://developer.mozilla.org/en-US/docs/HTML/Element/blockquote#Notes">Notes</a> for how to change it). A URL for the source of the quotation may be given using the <strong>cite</strong> attribute, while a text representation of the source can be given using the <a title="The HTML Citation Element <cite> represents a reference to a creative work. It must include the title of a work or a URL reference, which may be in an abbreviated form according to the conventions used for the addition of citation metadata." href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/cite"><code><cite></code></a> element.</p>
<p><cite>multiple contributors</cite> - MDN HTML element reference - blockquote</p>
<th> </th>
<th><a href="http://example.org/">John Doe</a></th>
<td>Because that's all Steve Jobs needed for a salary.</td>
<th><a href="http://example.org/">Jane Doe</a></th>
<td>For all the blogging she does.</td>
<th><a href="http://example.org/">Fred Bloggs</a></th>
<td>Pictures are worth a thousand words, right? So Jane x 1,000.</td>
<th><a href="http://example.org/">Jane Bloggs</a></th>
<td>With hair like that?! Enough said...</td>
<h2>Definition Lists</h2>
<dt>Definition List Title</dt>
<dd>Definition list division.</dd>
<dd>A startup company or startup is a company or temporary organization designed to search for a repeatable and scalable business model.</dd>
<dd>Coined by Rob Dyrdek and his personal body guard Christopher "Big Black" Boykins, "Do Work" works as a self motivator, to motivating your friends.</dd>
<dt>Do It Live</dt>
<dd>I'll let Bill O'Reilly will <a title="We'll Do It Live" href="https://www.youtube.com/watch?v=O_HyZ5aW76c">explain</a> this one.</dd>
<h2>Unordered Lists (Nested)</h2>
<li>List item one
<li>List item one
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
<h2>Ordered List (Nested)</h2>
<ol start="8">
<li>List item one -start at 8
<li>List item one
<ol reversed="reversed">
<li>List item one -reversed attribute</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
<h2>HTML Tags</h2>
<p>These supported tags come from the WordPress.com code <a title="Code" href="https://en.support.wordpress.com/code/">FAQ</a>.</p>
<p><strong>Address Tag</strong></p>
<address>1 Infinite Loop<br />Cupertino, CA 95014<br />United States</address>
<p><strong>Anchor Tag (aka. Link)</strong></p>
<p>This is an example of a <a title="WordPress Foundation" href="https://wordpressfoundation.org/">link</a>.</p>
<p><strong>Abbreviation Tag</strong></p>
<p>The abbreviation <abbr title="Seriously">srsly</abbr> stands for "seriously".</p>
<p><strong>Acronym Tag (<em>deprecated in HTML5</em>)</strong></p>
<p>The acronym <acronym title="For The Win">ftw</acronym> stands for "for the win".</p>
<p><strong>Big Tag</strong> (<em>deprecated in HTML5</em>)</p>
<p>These tests are a <big>big</big> deal, but this tag is no longer supported in HTML5.</p>
<p><strong>Cite Tag</strong></p>
<p>"Code is poetry." --<cite>Automattic</cite></p>
<p><strong>Code Tag</strong></p>
<p>This tag styles blocks of code.<br /><code>.post-title {<br />
	margin: 0 0 5px;<br />
	font-weight: bold;<br />
	font-size: 38px;<br />
	line-height: 1.2;<br />
	and here's a line of some really, really, really, really long text, just to see how it is handled and to find out how it overflows;<br />
}</code><br />You will learn later on in these tests that <code>word-wrap: break-word;</code> will be your best friend.</p>
<p><strong>Delete Tag</strong></p>
<p>This tag will let you <del cite="deleted it">strike out text</del>, but this tag is <em>recommended</em> supported in HTML5 (use the <code><s></code> instead).</p>
<p><strong>Emphasize Tag</strong></p>
<p>The emphasize tag should <em>italicize</em> <i>text</i>.</p>
<p><strong>Horizontal Rule Tag</strong></p>
<hr />
<p>This sentence is following a <code><hr /></code> tag.</p>
<p><strong>Insert Tag</strong></p>
<p>This tag should denote <ins cite="inserted it">inserted</ins> text.</p>
<p><strong>Keyboard Tag</strong></p>
<p>This scarcely known tag emulates <kbd>keyboard text</kbd>, which is usually styled like the <code><code></code> tag.</p>
<p><strong>Preformatted Tag</strong></p>
<p>This tag is for preserving whitespace as typed, such as in poetry or ASCII art.</p>
<h2>The Road Not Taken</h2>
<pre><cite>Robert Frost</cite>

  Two roads diverged in a yellow wood,
  And sorry I could not travel both          (\_/)
  And be one traveler, long I stood         (='.'=)
  And looked down one as far as I could     (")_(")
  To where it bent in the undergrowth;

  Then took the other, as just as fair,
  And having perhaps the better claim,          |\_/|
  Because it was grassy and wanted wear;       / @ @ \
  Though as for that the passing there        ( > º < )
  Had worn them really about the same,         `>>x<<´
                                               /  O  \
  And both that morning equally lay
  In leaves no step had trodden black.
  Oh, I kept the first for another day!
  Yet knowing how way leads on to way,
  I doubted if I should ever come back.

  I shall be telling this with a sigh
  Somewhere ages and ages hence:
  Two roads diverged in a wood, and I—
  I took the one less traveled by,
  And that has made all the difference.

  and here's a line of some really, really, really, really long text, just to see how it is handled and to find out how it overflows;
<p><strong>Quote Tag</strong> for short, inline quotes</p>
<p><q>Developers, developers, developers...</q> --Steve Ballmer</p>
<p><strong>Strike Tag</strong> (<em>deprecated in HTML5</em>) and <strong>S Tag</strong></p>
<p>This tag shows <span style="text-decoration: line-through;">strike-through</span> <s>text</s>.</p>
<p><strong>Small Tag</strong></p>
<p>This tag shows <small>smaller<small> text.</small></small></p>
<p><strong>Strong Tag</strong></p>
<p>This tag shows <strong>bold<strong> text.</strong></strong></p>
<p><strong>Subscript Tag</strong></p>
<p>Getting our science styling on with H<sub>2</sub>O, which should push the "2" down.</p>
<p><strong>Superscript Tag</strong></p>
<p>Still sticking with science and Albert Einstein's E = MC<sup>2</sup>, which should lift the 2 up.</p>
<p><strong>Teletype Tag </strong>(<em>obsolete in HTML5</em>)</p>
<p>This rarely used tag emulates <tt>teletype text</tt>, which is usually styled like the <code><code></code> tag.</p>
<p><strong>Underline Tag</strong> <em>deprecated in HTML 4, re-introduced in HTML5 with other semantics</em></p>
<p>This tag shows <u>underlined text</u>.</p>
<p><strong>Variable Tag</strong></p>
<p>This allows you to denote <var>variables</var>.</p>

WHM/cPanel – list all sites

var sites = '';
document.querySelectorAll("#listaccts > tbody > tr > td:nth-child(2) > a").forEach(function(el) {
    sites += el.innerText.trim() + "\n";

youtube-dl – download videos from a list

youtube-dl --download-archive done.txt -a download.txt -f 135+140 --restrict-filenames -r 1000k -o '%(uploader)s/%(uploader)s-%(upload_date)s-%(title)s.%(ext)s'

Samsung UR55 Color settings

Issue: yellowish tint on default settings

Correct settings:

Color Tone: Custom
Gamma: Mode 1
Red: 44
Green: 49
Blue: 64

Samsung Magic Bright: Custom
Brightness: 100
Contrast: 80
Sharpness: 52
Samsung Upscale: off
HDMI Black level: Normal
Eye Saver Mode: off
Game mode: off
Response Time: Faster
Screen Ratio: Wide

WampServer – SSL per vhost

<VirtualHost myproject.local.test:443>
    DocumentRoot "D:/arvil/Projects/vhosted/myproject.local.test/public_html"
    ServerName myproject.local.test:443
    ServerAdmin xxx@xxx.com
     <Directory "D:/arvil/Projects/vhosted/myproject.local.test/public_html">
        AllowOverride All
        Require local
    SSLEngine on
    SSLCertificateFile "D:/arvil/Projects/vhosted/myproject.local.test/myproject.local.test.cert"
    SSLCertificateKeyFile "D:/arvil/Projects/vhosted/myproject.local.test/myproject.local.test.key"
    <FilesMatch "\.(cgi|shtml|phtml|php)$">
        SSLOptions +StdEnvVars
    <Directory "D:/Applications/wamp64/bin/apache/apache2.4.37/cgi-bin">
        SSLOptions +StdEnvVars
    BrowserMatch "MSIE [2-5]" \
             nokeepalive ssl-unclean-shutdown \
             downgrade-1.0 force-response-1.0

wp-cli as bash alias

#on ~/.bash_profile, add:
alias wp='php -d "disable_functions=" /<path_to>/wp-cli.phar'

Acquia Dev Desktop – use Drush 7 for Drupal 7 sites

// returns empty string
export DEVDESKTOP_DRUPAL_SETTINGS_DIR=$HOME/.acquia/DevDesktop/DrupalSettings
// returns:
//  ~/.acquia/DevDesktop/DrupalSettings
vendor/drush/drush/drush --verbose --debug info
// returns
// Drush bootstrap phase : bootstrap_drupal_database() [0.27 sec, 5.39 MB]                                                                                                [bootstrap]
// Successfully connected to the Drupal database. [0.29 sec, 5.75 MB]                                                                                                     [bootstrap]

WordPress – add a new admin user directly using database

# Replace the following:
# <WP TABLE PREFIX> = "wp_"

INSERT INTO `<DATABASE NAME>`.`<WP TABLE PREFIX>users` (`user_login`, `user_pass`, `user_email`, `user_registered`) VALUES ('new_admin', MD5('123456'), 'new_admin@test.com', NOW());

# Get the user id of the use
# Replace <ADDED USER ID>
INSERT INTO `<DATABASE NAME>`.`<WP TABLE PREFIX>usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '<ADDED USER ID>', '<WP TABLE PREFIX>capabilities', 'a:1:{s:13:"administrator";b:1;}');

INSERT INTO `<DATABASE NAME>`.`<WP TABLE PREFIX>usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '<ADDED USER ID>', '<WP TABLE PREFIX>user_level', '10');

WordPress – Optimisation

<FilesMatch "\.(js|css|jpg|gif|png|pdf|swf|svg|svgz|ico|ttf|ttc|otf|eot|woff|woff2|webp)$">
 <IfModule mod_headers.c>
    ExpiresActive On
    ExpiresDefault  "access plus 1 year"
    Header set Cache-Control "public, immutable, max-age=31536000, s-maxage=31536000"
    Header set Access-Control-Allow-Origin "*"


## Comment out:
#<IfModule mod_expires.c>
#        ExpiresActive On
#        ExpiresByType text/css A30672000
#        ExpiresByType text/javascript A30672000
#        ExpiresByType application/javascript A30672000
#<IfModule mod_headers.c>
#    Header append Cache-Control "public, immutable"

## Add
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access 1 year"
    ExpiresByType text/javascript "access 1 year"
    ExpiresByType application/javascript "access 1 year"
    Header set Cache-Control "public, immutable, max-age=31536000, s-maxage=31536000"
    Header set Access-Control-Allow-Origin "*"

youtube-dl – Pluralsight

youtube-dl -u "username" \
-p "password" \
-i \
-c \
--no-check-certificate \
--console-title \
--max-sleep-interval 240 \
--min-sleep-interval 180 \
--add-header Referer:"https://app.pluralsight.com/library/" \
-o '%(playlist_title)s/%(chapter_number)s - %(chapter)s/%(playlist_index)s-%(title)s.%(ext)s' \
-f 'best[height<=720]/worst[height>720]' \
--rate-limit 600k \

wget – download a wordpress from ftp

wget -c -m --ftp-user='' --ftp-password=''  --exclude-directories=/wp-content/uploads/,/wp-admin/,/wp-includes/ --reject sql