Get a headstart with install.php & Jetpack

Discover how to customize your WordPress installation to earn some time in your projects.

About me

Automattic

Automattic Products

Install WP, with a twist!

install.php

/**
 * Set a site description.
 */
update_option( 'blogdescription', 'A site description' );
/**
 * Set Timezone.
 */
$timezone = "Europe/Bucharest";
update_option( 'timezone_string', $timezone );
/**
 * Start the week on Monday.
 */
update_option( 'start_of_week', 1 );
/**
 * Create an editor.
 */
$username = 'jeherve';
$userdata = array(
	'user_login'	=> $username,
	'user_pass'	=> wp_generate_password(),
	'user_email'	=> 'jeremy@jeremy.hu',
	'user_url'		=> 'http://jeremy.hu/',
	'role'			=> 'editor'
);

$self_id = username_exists( $username );

if ( ! $self_id ) {
	$self_id = wp_insert_user( $userdata );
	update_user_option( $self_id, 'default_password_nag', true, true );
}
/**
 * Delete the default post.
 */
wp_delete_post( 1, true );
/**
 * Enable your favourite plugins.
 */
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );

// Your plugin list.
$plugin_list = array(
	'akismet/akismet.php',
	'jeherve-func/jeherve-func.php',
	'jetpack/jetpack.php',
	'vaultpress/vaultpress.php'
);

// Enable each one of them.
foreach( $plugin_list as $plugin ) {
	$plugin_dir = WP_PLUGIN_DIR . "/{$plugin}";
	if ( file_exists( $plugin_dir ) && ! is_plugin_active( $plugin ) ) {
		activate_plugin( $plugin );
	}
}

Customize your WP installation with plugins

Security Options

/**
 * Force deactivate pingbacks.
 */
function jeherve_deactivate_pings( $methods ) {
	unset( $methods['pingback.ping'] );
	return $methods;
}
add_filter( 'xmlrpc_methods', 'jeherve_deactivate_pings' );
// No one can register, ever.
function jeherve_option_users_can_register( $value ) {
	return '0';
}
add_filter( 'pre_option_users_can_register', 'jeherve_option_users_can_register' );

// Force the admin email address.
function jeherve_option_admin_email( $value ) {
	return 'jeremy@jeremy.hu';
}
add_filter( 'option_admin_email', 'jeherve_option_admin_email' );

Auto-update Options

// Automatically update plugins.
add_filter( 'auto_update_plugin', '__return_true' );

// Automatically update themes.
add_filter( 'auto_update_theme', '__return_true' );

Functionality plugins

Set up Akismet

/**
 * Automatically set Akismet to use your API Key.
 * http://apikey.wordpress.com/
 */
function jeherve_akismet_key() {
	return 'YOUR_API_KEY';
}
add_filter( 'akismet_get_api_key', 'jeherve_akismet_key' );
Jetpack

Why should I install it?

Kill modules

Remove modules

// Do not activate, and hide the Stats module so your clients can't activate it later.
function jeherve_kill_stats( $modules ) {
	unset( $modules['stats'] );
	return $modules;
}
add_filter( 'jetpack_get_available_modules', 'jeherve_kill_stats' );
Photon

Photon: lossy image compression

// Compress the quality of all jpeg files.
function jeherve_loss_compression_photon( $args ) {
	$args['quality'] = 80;
	return $args;
}
add_filter( 'jetpack_photon_pre_args', 'jeherve_loss_compression_photon' );
WordPress.com log in form
// Redirect all logins to WordPress.com.
add_filter( 'jetpack_sso_bypass_login_forward_wpcom', '__return_true' );

// Or hide your log in form, and only show a WordPress.com log in button.
add_filter( 'jetpack_remove_login_form', '__return_true' );
Sharing counts
/**
 * Disable counts from Jetpack Sharing buttons.
 */
add_filter( 'jetpack_sharing_counts', '__return_false' );
Jetpack on GitHub

Need more filters?

Functionality plugins: get a headstart on your new site

Questions?

Use a spacebar or arrow keys to navigate