Skip to content

Instantly share code, notes, and snippets.

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');
}
@qant

This comment has been minimized.

Copy link

@qant qant commented May 6, 2021

i wonder why so many trim()?

@mustafauysal

This comment has been minimized.

Copy link
Owner Author

@mustafauysal mustafauysal commented May 7, 2021

@qant It seems like a rookie mistake, and absolutely no making sense at all. Btw I'm wondering, how did you found a secret gist from 2014? 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment