Skip to content

Instantly share code, notes, and snippets.

View theandystratton's full-sized avatar

Andy Stratton theandystratton

View GitHub Profile
--------------------------------------------------------------------------------------
-- Handled with \define( 'WP_HOME', 'NEWURL' ) and \define( 'WP_SITEURL', 'NEWURL' )
--------------------------------------------------------------------------------------
UPDATE wp_options SET option_value = 'NEWURL' WHERE option_name IN ( 'home', 'siteurl' );
--------------------------------------------------------------------------------------
-- replace option values, but careful as it could include serialized data,
-- added a clause to try to avoid that...
--------------------------------------------------------------------------------------
UPDATE
@theandystratton
theandystratton / pr-login-error-customization.php
Created October 29, 2021 15:39
Page Restrict Filter Login Errors
<?php
// this can be added to your functions.php file
\add_filter( 'pr_login_errors', function( $messages ){
$new_messages = [ 'Please enter a valid username and password' ];
return $new_messages;
}, 10, 1 );
UPDATE wp_options
SET option_value = 'https://dev.website.com'
WHERE option_name IN ( 'home', 'siteurl' );
<?php
//
// Add the following code to your functions.php or
// save this file to your /wp-content/mu-plugins/ folder.
//
\add_filter( 'pr_message_content', function( $content ){
return \do_shortcode( $content );
});
mysqldump -u root -p --all-databases > alldb.sql
mysqldump -u root -p --opt --all-databases > alldb.sql
mysqldump -u root -p --all-databases --skip-lock-tables > alldb.sql
mysqldump -u root -p --all-databases --single-transaction --skip-lock-tables > all-your-db.sql
<!-- Typical builds -->
<style>
.heading { color: blue; }
.list-red { color: red; }
p.intro { font-size: 1.2em; }
p.intro span { font-weight: bold;}
</style>
<section class="section section__prices">
<?php
foreach ( [ 'Andy', 'Drew', 'Rob', 'Shane', 'Chris' ] as $name )
{
switch ( $name )
{
case 'Rob' :
case 'Drew' :
case 'Shane' :
// continue; // acts as break within switch(); needs arg "2"
continue 2;
@theandystratton
theandystratton / git-checkout-revision.sh
Created June 7, 2019 15:00
git checkout revision for file
git checkout $revision-hash file-name.php
location ~* ^/wp-content/.*\.(png|jpe?g)$ {
add_header Vary Accept;
if ($http_accept !~* "webp"){
break;
}
if ( !-f $request_filename ) {
return 404;
}