Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: wpmu_new_blog is deprecated since version 5.1.0 #18

Open
ipokkel opened this issue Oct 21, 2019 · 0 comments
Open

BUG: wpmu_new_blog is deprecated since version 5.1.0 #18

ipokkel opened this issue Oct 21, 2019 · 0 comments

Comments

@ipokkel
Copy link
Member

ipokkel commented Oct 21, 2019

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant