Support

Account

Home Forums Backend Issues (wp-admin) Changing the Blogname

Solved

Changing the Blogname

  • Hey there!

    i am using the code below to change my Blogtitle by a custom field in the option tree via the functions php:

    	$value = get_field('blogtitle', 'option');		
    	if ($value) {
    		update_option('blogname', $value);
    	} else {
        	update_option( 'blogname', '' );	
    	}
    

    if i update or deactivate the acf plugin i get an error for the variable $value. How can i check if acf is existing/activated?

    Thank you in avance!

  • The following code checks if the ACF Pro or ACF plugins are not activated.

    /* Checks to see if "is_plugin_active" function exists and if not load the php file that includes that function */
    if ( ! function_exists( 'is_plugin_active' ) ) {
    	include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 
    }
    
    /* Checks to see if the acf pro plugin is not activated  */
    if ( !is_plugin_active('advanced-custom-fields-pro/acf.php') )  {
     /* Do something when not active */
    }
    
    /* Checks to see if the acf plugin is not activated  */
    if ( !is_plugin_active('advanced-custom-fields/acf.php') )  {
      /* Do something when not active */
    }
  • Thank you!

    I just missed to write

    if ( ! function_exists( 'is_plugin_active' ) ) {
    	include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 
    }

    while i was calling:

    if ( is_plugin_active('advanced-custom-fields-pro/acf.php') )  {
        /* My code goes here */
    }

    in my previous attempts.

    Solved, Thank you very much!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Changing the Blogname’ is closed to new replies.