Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update wordpress blogname and blogdescription using Redux

Is it possible to update wordpress blogname and blogdescription via Redux framework.

array(
    'id'        => 'blogdescription',
    'type'      => 'text',
    'title'     => 'Blog Description',
    'default'   => '',
),
like image 292
cbm Avatar asked Nov 30 '25 03:11

cbm


1 Answers

You can use update_option(); function

update_option( 'blogname', 'New Value' );

update_option( 'blogdescription', 'New Value' );

Hooking on Admin

add_action('admin_init', 'update_my_site_blog_info');
function update_my_site_blog_info() {
    $old  = get_option('blogdescription');
    $new = 'New Site Title';
    if ( $old  !== $new ) {
        update_option( 'blogdescription', $new  );
    }
}

EDIT:

I guess its better this way,

add_filter('redux/options/[your_opt_name]/compiler', 'update_my_site_blog_info');
function update_my_site_blog_info() {
    $new = 'New Site Title';
    update_option( 'blogdescription', $new  );
}

then your field needs to enabled compiler

array(
    'id'        => 'blogdescription',
    'type'      => 'text',
    'title'     => 'Blog Description',
    'default'   => '',
    'compiler'  => true,
),
like image 190
silver Avatar answered Dec 02 '25 16:12

silver