wp_install_defaults

Definition:
function wp_install_defaults($user_id) {}

Parameters

  • int $user_id: User ID.

Source code

function wp_install_defaults($user_id) {

	global $wpdb, $wp_rewrite, $current_site, $table_prefix;



	// Default category

	$cat_name = __('Uncategorized');

	/* translators: Default category slug */

	$cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug'));



	if ( global_terms_enabled() ) {

		$cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );

		if ( $cat_id == null ) {

			$wpdb->insert( $wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)) );

			$cat_id = $wpdb->insert_id;

		}

		update_option('default_category', $cat_id);

	} else {

3801

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: