- determine site ID (for example:
5
) - create a spot where the new website will live (for example:
/www/mywebsite.nl/public
) - install a new WordPress
cd /www/mywebsite.nl/public ; wp core download
- copy theme(s) and plugins
<?php // wp-content/mu-plugins/ga4.php - GA4 tracker boilerplate. | |
define('GA_NOT_LIVE', true); // remove for go | |
define('GA4_MEASUREMENT_ID', 'G-XXXXXXXXXX'); // required | |
define('UA_PROPERTY_ID', 'UA-XXXXXXX-YY'); // optional | |
define('GA_ANONYMIZE_IP', true); // optional | |
define('GA_TRACK_ADMINS', false); // optional, defaults to true | |
define('GA_TRACK_EDITORS', false); // optional, defaults to true | |
// we need GA as first thing in the body |
<?php | |
function migrate_webp_express_htaccess_files() { | |
$extra = []; | |
$uploads = wp_upload_dir(); | |
$uploads = $uploads['basedir']; | |
$themes = WP_CONTENT_DIR .'/themes'; | |
$plugins = WP_CONTENT_DIR .'/plugins'; |
#!/usr/bin/env bash | |
### | |
# This script creates a backup using the WP-CLI tool and then stores it in a GIT repository. | |
# As GIT only saves the changes, you have a nice history of stuff that happened on your website. | |
# This is mostly an investigation tool and I have yet to determine the usefulness :) | |
# | |
# p.s., this does not work if git or wp-cli is installed; ergo; does NOT work with Local by Flywheel (unless you ssh into the docker and `sudo apt-get install git`. | |
## |
/** SCSS */ | |
/** Fuck those small screens! */ | |
@for $i from 0 through 16 { | |
@media all and (max-width: ( 375px - ($i*10px) )) { | |
body { | |
zoom: ( 375px - ($i*10px) ) / 385px; | |
} | |
} | |
} |
<?php | |
// supports Yoast SEO and Yoast SEO Premium | |
add_filter('wpseo_sitemap_entry', 'wpseo_sitemap_entry', 10, 3); | |
// Supports SEO by Rank Math | |
add_filter('rank_math/sitemap/entry', 'wpseo_sitemap_entry', 10, 3); | |
function wpseo_sitemap_entry ( $url, $type, $object ) { | |
global $sitepress; |
<?php | |
/** | |
* Translate post-type-archive-slug when different from post-type-slug. | |
* | |
* You can have your archive slug set to, for example /books and the singles on /book/title by setting | |
* $args['rewrite'] => [ 'slug' => 'book', ... ]; | |
* $args['has_archive'] => 'books'; | |
* when registering your post_type | |
* |
<?php | |
/** | |
* Hook in the 'errors' hook as this is just in time and allows us to return an error in case of conflict. | |
* | |
* @package rmpel/WordPress | |
* @subpackage rmpel/WordPress/AllowUsernameChange | |
*/ | |
add_action( | |
'user_profile_update_errors', |
<?php | |
/** | |
* Notes on the following section | |
* | |
* Correct set-up is: | |
* | |
* Set your page-for-posts to a certain WordPress Posts, for example /nl/nieuws/ | |
* Set your permalink structure to the same; /nieuws/%postname%/ | |
* |
<?php | |
// redirect to language if no language | |
add_action( 'after_setup_theme', function () { | |
if ( is_admin() ) { | |
// we are on admin; do nothing | |
return; | |
} | |
if ( $GLOBALS['pagenow'] === 'wp-login.php' ) { |