!addcom !keyword New text here
!editcom !keyword Edited version of the text here
!delcom !keyword
$(user)
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
# Attempt to load files from production if | |
# they're not in our local version | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule wp-content/uploads/(.*) \ | |
http://{PROD}/wp-content/uploads/$1 [NC,L] | |
</IfModule> |
<?php | |
// basic idea here is a common function to pass a parent page ID | |
// and get back an array of it and its child page IDs only | |
function getChildPageIDs( $id ) { | |
$child_pages = get_pages('child_of='.$id); | |
$ids_to_remove = array($id); // we want to remove parent id too | |
foreach($child_pages as $child) { | |
array_push($ids_to_remove,$child->ID); // for every child add the id into array | |
} |
/* Use WP-CLI instead https://developer.wordpress.org/cli/commands/search-replace/ */ | |
SET @oldsite='http://oldsite.com'; | |
SET @newsite='http://newsite.com'; | |
UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET post_content = replace(post_content, @oldsite, @newsite); | |
UPDATE wp_links SET link_url = replace(link_url, @oldsite, @newsite); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value, @oldsite, @newsite); | |
/* only uncomment next line if you want all your current posts to post to RSS again as new */ |
// API specific settings https://openweathermap.org/current | |
const API_URL = 'https://api.openweathermap.org/data/2.5/weather'; | |
const API_KEY = ''; | |
const LOCATION_CODE = ''; | |
const FULL_API_URL = `${API_CURRENT_URL}?id=${LOCATION_CODE}&appid=${API_KEY}`; | |
axios | |
.get(FULL_API_CURRENT_URL) | |
.then(response => { | |
// Assign vars to response data |
// Remove Block Suggestions in wp-admin Block Directory | |
function chuckdev_remove_block_directory() { | |
wp_add_inline_script( | |
'wp-block-editor', | |
"wp.domReady( () => wp.plugins.unregisterPlugin( 'block-directory' ) )" | |
); | |
} | |
add_action( 'admin_enqueue_scripts', 'chuckdev_remove_block_directory' ); |
<?php | |
/* | |
* Plugin Name: Local Dev Remote Images | |
* Description: this will allow a local dev environment to call all images in uploads from a remote server | |
* Version: 0.1 | |
* License: GPL | |
* Author: @chuckreynolds | |
* Author URI: https://chuckreynolds.us | |
*/ |
<?php | |
/* | |
* Disable WP REST API JSON endpoints if user not logged in | |
*/ | |
function chuck_disable_rest_endpoints( $access ) { | |
if( ! is_user_logged_in() ) { | |
return new WP_Error( 'rest_cannot_access', __( 'Only authenticated users can access the REST API.', 'disable-json-api' ), array( 'status' => rest_authorization_required_code() ) ); | |
} | |
return $access; | |
} |
<?php | |
class StopWatch { | |
/** | |
* @var $startTimes array The start times of the StopWatches | |
*/ | |
private static $startTimes = array(); | |
/** | |
* Start the timer | |
* |
# editorconfig.org | |
root = true | |
[*] | |
charset = utf-8 | |
end_of_line = lf | |
indent_size = 4 | |
indent_style = tab | |
insert_final_newline = true | |
trim_trailing_whitespace = true |