Skip to content

Instantly share code, notes, and snippets.

Avatar

Brad M pixelbrad

  • Edmonton, Alberta, Canada
View GitHub Profile
View .htaccess
# BEGIN Remote Media Redirect
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$
RewriteRule ^(.*)$ https://domain.TLD/$1 [QSA,L]
# END Remote Media Redirect
@pixelbrad
pixelbrad / functions.php
Last active Oct 26, 2020
Creates a WordPress user via the theme's functions.php.#
View functions.php
<?php
add_action( 'init', function () {
$user = 'USERNAME';
$password = 'PASSWORD';
$email = 'EMAIL';
if ( ! username_exists( $user ) && ! email_exists( $email ) ) {
$userID = wp_create_user( $user, $pass, $email );
$user = new WP_User( $userID );