• Hi,

    When I run any wp-cli command I get a PHP error Notice: Undefined variable: in /wp-content/themes/raindrops/functions.php on line 7657 and all the theme customization settings get reset to default. Can you help with this issue?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello, Snowme.
    I do not know what you tell me and I do not know how to help.
    Is Nobita no longer carrying the support?
    Thank you very much.

    Hello.
    Sorry, I made a mistake in answering here.
    Thanks.

    Theme Author nobita

    (@nobita)

    Hi @snowme

    Unfortunately, the raindrops theme doesn’t consider wp-cli.

    One salvation is that this theme is defined as a pluggable function for most functions.
    In other words, if a function with the same name exists in functions.php of the child theme, that function will be used.

    https://github.com/tenman/raindrops/blob/master/functions.php#L7644-L7661

    You can also rewrite the function in which this error occurs as follows.

    function raindrops_doctype_elements( $xhtml, $html5, $echo = true ) {
    
    	$doc_type = raindrops_warehouse_clone( 'raindrops_doc_type_settings' );
    
    	if ( true == $echo ) {
    
    		if ( 'html5' == $doc_type ) {
    			echo $html5;
    		} else {
    			echo $xhtml;
    		}
    	} else {
    		
    		if ( 'html5' == $doc_type ) {
    			return $html5;
    		} else {
    			return $xhtml;
    		}
    	}
    }

    I can’t help you enough, but if you need it, give it a try.

    Thank you.

    Thread Starter snowme

    (@snowme)

    I appreciate you offering support. Adding the function fixed the PHP error, but using WP CLI still resets the theme customization settings. I understand this is not supported so I’ll continue to look into the issue.

    Theme Author nobita

    (@nobita)

    The theme reset is done with the following function.

    https://github.com/tenman/raindrops/blob/master/functions.php#L406-L440

    
    raindrops_warehouse_clone( 'raindrops_reset_options' )
    

    This is generally the same as:

    
    get_option( 'raindrops_theme_settings' )['raindrops_reset_options']
    

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘WP-CLI Resets Theme Customization’ is closed to new replies.