The blog_details WordPress PHP filter allows you to modify a blog’s details.
Usage
add_filter('blog_details', 'your_custom_function');
function your_custom_function($details) {
// your custom code here
return $details;
}
Parameters
- $details (WP_Site): The blog details to be filtered.
More information
See WordPress Developer Resources: blog_details
Examples
Modify blog’s name
Change the blog’s name by appending a custom text.
add_filter('blog_details', 'modify_blog_name');
function modify_blog_name($details) {
$details->blogname .= ' - Custom Text';
return $details;
}
Change blog’s description
Update the blog’s description to a new custom description.
add_filter('blog_details', 'change_blog_description');
function change_blog_description($details) {
$details->blogdescription = 'My new custom description';
return $details;
}
Add a custom field to blog details
Add a custom field to the blog details.
add_filter('blog_details', 'add_custom_field_to_blog_details');
function add_custom_field_to_blog_details($details) {
$details->custom_field = 'Custom value';
return $details;
}
Set custom language for a blog
Set a specific language for the blog.
add_filter('blog_details', 'set_custom_language');
function set_custom_language($details) {
$details->WPLANG = 'en_US';
return $details;
}
Update blog’s home URL
Update the blog’s home URL to a new custom URL.
add_filter('blog_details', 'update_blog_home_url');
function update_blog_home_url($details) {
$details->home = 'https://custom-url.example.com';
return $details;
}