When creating a new site, the server throws a PHP warning wpmu_new_blog is deprecated since version 5.1.0
|
function pmpron_new_blogs_settings($blog_id) |
|
{ |
|
global $wpdb; |
|
|
|
//change the default theme |
|
/* |
|
update_blog_option($blog_id, 'current_theme', 'Your Theme Name'); |
|
update_blog_option($blog_id, 'template', 'your-theme-directory'); |
|
update_blog_option($blog_id, 'stylesheet', 'your-theme-directory'); |
|
*/ |
|
|
|
//change the subtitle "blogdescription" |
|
update_blog_option($blog_id, 'blogdescription', 'Change your subtitle'); |
|
|
|
//change the category 1 to "general" (pet peeve of mine) |
|
$sqlQuery = "UPDATE " . $wpdb->prefix . $blog_id . "_terms SET name = 'General', slug = 'general' WHERE term_id = 1 LIMIT 1"; |
|
$wpdb->query($sqlQuery); |
|
|
|
//make the blog public |
|
$sqlQuery = "UPDATE $wpdb->blogs SET public = 1 WHERE blog_id = '" . $blog_id . "' LIMIT 1"; |
|
$wpdb->query($sqlQuery); |
|
|
|
//add some other categories |
|
/* |
|
wls_add_category($blog_id, "Books", "books"); |
|
wls_add_category($blog_id, "Events", "events"); |
|
wls_add_category($blog_id, "Food", "food"); |
|
wls_add_category($blog_id, "News and Interest", "news"); |
|
*/ |
|
} |
|
//actions |
|
add_action( 'wpmu_new_blog', 'pmpron_new_blogs_settings' ); |
See: https://developer.wordpress.org/reference/hooks/wpmu_new_blog/
Moderators (Only):
https://www.paidmembershipspro.com/forums/topic/creating-a-site-returns-php-warnings-for-a-deprecated-hook/