Bug Fix – Genesis Featured Content Widget – Fatal error: Call to undefined function genesis_get_option()

The Genesis sandbox featured content widget ( plugin ) by Travis Smith can only be activated when Genesis is active. However, if you have already successfully activated the plugin, after activating Genesis, you can cause a fatal error if you change to a different parent theme like Twenty Sixteen.

To fix this, the plugin needs an additional check added on line 87 of genesis-featured-content-widget/gs-featured-content-widget.php

/** require Genesis */
if ( ! function_exists( 'genesis_get_option' ) ) {
    return;
}

Now the entire function will look like this:

add_action( 'widgets_init', 'gsfc_widgets_init', 50 );
/**
 * Register GSFC for use in the Genesis theme.
 *
 * @since 1.1.0
 */
function gsfc_widgets_init() {
    if ( class_exists( 'Premise_Base' ) && !is_admin() ) {
        return;
    }
    
    /** require Genesis */
	if ( ! function_exists( 'genesis_get_option' ) ) {
		return;
	}
		
    $gfwa = genesis_get_option( 'gsfc_gfwa' );
    if ( class_exists( 'Genesis_Featured_Widget_Amplified' ) && $gfwa ) {
        unregister_widget( 'Genesis_Featured_Widget_Amplified' );
    }
    register_widget( 'GS_Featured_Content' );
}

Otherwise, you’ll get the following fatal error message:

Fatal error: Call to undefined function genesis_get_option() in genesis-featured-content-widget/gs-featured-content-widget.php on line 92

fatal-error

This bug fix relates to resolving this question on the StudioPress community forums.

You can download the latest version of the Genesis Sandbox Featured Content Widget from WordPress.org

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.