Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Snippet for local WordPress development
<?php
/**
* Plugin Name: Local Dev modifications
* Plugin URI: https://kathyisawesome.com/
* Description: Custom snippets for local development
* Version: 1.0.0
* Author: Kathy Darling
* Author URI: https://kathyisawesome.com
*/
defined( 'ABSPATH' ) || exit;
function print_filters_for( $hook = '' ) {
global $wp_filter;
$result = ! empty( $hook ) && isset( $wp_filter[$hook] ) ? $wp_filter[$hook] : 'none';
print 'filters for : ' . $hook;
print '<pre>';
print_r( $result );
print '</pre>';
}
// Always use latest scripts for NYP.
//define( 'WC_NYP_SCRIPT_CACHE_BUST', true );
// Cache-bust all scripts/styles.
function vc_add_timestamp_css_js( $src ) {
if( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
$src = add_query_arg( 'time', time(), $src );
}
return $src;
}
add_filter( 'style_loader_src', 'vc_add_timestamp_css_js', 9999 );
add_filter( 'script_loader_src', 'vc_add_timestamp_css_js', 9999 );
/**
* Remove Ancient Custom Fields metabox from post editor
* because it uses a very slow query meta_key sort query
* so on sites with large postmeta tables it is super slow
* and is rarely useful anymore on any site
*/
function s9_remove_post_custom_fields_metabox() {
foreach ( get_post_types( '', 'names' ) as $post_type ) {
remove_meta_box( 'postcustom' , $post_type , 'normal' );
}
}
add_action( 'admin_menu' , 's9_remove_post_custom_fields_metabox' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment