Skip to content

Instantly share code, notes, and snippets.

@mustafauysal mustafauysal/enable-local-plugins.php Secret
Last active Mar 10, 2019

Embed
What would you like to do?
Update site info and activate plugins that I only need local
<?php
if ( defined( 'WP_LOCAL_DEV' ) && WP_LOCAL_DEV ) {
update_option('siteurl','http://local.example.dev');
update_option('home','http://local.example.dev');
function activate_local_plugin( $plugin ) {
$current = get_option( 'active_plugins' );
$plugin = plugin_basename( trim( $plugin ) );
if ( !in_array( $plugin, $current ) ) {
$current[] = $plugin;
sort( $current );
do_action( 'activate_plugin', trim( $plugin ) );
update_option( 'active_plugins', $current );
do_action( 'activate_' . trim( $plugin ) );
do_action( 'activated_plugin', trim( $plugin) );
}
return null;
}
activate_local_plugin('uploads-by-proxy/uploads-by-proxy.php');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.