• I removed wp files from public_html to test new theme i’m working on.

    After re-uploading the old one a 2nd time i get this error:

    —————————————————————————————–
    Warning: require_once(/home/alfasteel/public_html/wp-includes/default-widgets.php): failed to open stream: No such file or directory in /home/alfasteel/public_html/wp-includes/functions.php on line 3285

    Fatal error: require_once(): Failed opening required ‘/home/alfasteel/public_html/wp-includes/default-widgets.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/alfasteel/public_html/wp-includes/functions.php on line 3285
    —————————————————————————————–

    The file exists; but once i upload it to the server and refresh winscp, it disappears!
    As you can see in the print screen, it’s widget related.

    https://prntscr.com/hk4rh8

    Really need to get this site up and running. Can you please help?

Viewing 5 replies - 1 through 5 (of 5 total)
  • what wp files did you remove and why?

    Thread Starter johnatanasoff

    (@johnatanasoff)

    As suggested by a friend; putting a ” return; ” before the code works.
    But it’s not the solution. For some reasons when i upload default-widgets.php to server and refresh, it disappears!

    Let me know the solution if possible.
    Thank you!

    —————————————————————————————
    return;
    require_once( ABSPATH . WPINC . ‘/default-widgets.php’ );

    add_action( ‘_admin_menu’, ‘wp_widgets_add_menu’ );
    }
    —————————————————————————————

    Thread Starter johnatanasoff

    (@johnatanasoff)

    @jaycbrf

    I didn’t remove any files!
    I copied files from live server to my PC; deleted files in public_html and uploaded another WP theme i am working on.

    When i did this procedure a second time it stopped working with the error.
    But look at my last reply as putting “return;” before the code in functions.php lets the site load!

    Let me know what you think?

    The code you are showing above is not complete. You have an add_action call for the admin_menu hook and a wp_widgets_add_menu function but you do not show the function… So I can not tell.

    Thread Starter johnatanasoff

    (@johnatanasoff)

    @jaycbrf

    Here’s the snippet you need from functions.php

    /**
     * Determines if Widgets library should be loaded.
     *
     * Checks to make sure that the widgets library hasn't already been loaded.
     * If it hasn't, then it will load the widgets library and run an action hook.
     *
     * @since 2.2.0
     */
    function wp_maybe_load_widgets() {
    	/**
    	 * Filter whether to load the Widgets library.
    	 *
    	 * Passing a falsey value to the filter will effectively short-circuit
    	 * the Widgets library from loading.
    	 *
    	 * @since 2.8.0
    	 *
    	 * @param bool $wp_maybe_load_widgets Whether to load the Widgets library.
    	 *                                    Default true.
    	 */
    	if ( ! apply_filters( 'load_default_widgets', true ) ) {
    		return;
    	}
    	return;
    	require_once( ABSPATH . WPINC . '/default-widgets.php' );
    
    	add_action( '_admin_menu', 'wp_widgets_add_menu' );
    }
    
    /**
     * Append the Widgets menu to the themes main menu.
     *
     * @since 2.2.0
     */
    function wp_widgets_add_menu() {
    	global $submenu;
    
    	if ( ! current_theme_supports( 'widgets' ) )
    		return;
    
    	$submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' );
    	ksort( $submenu['themes.php'], SORT_NUMERIC );
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Warning: require_once(/home/x/public_html/wp-includes/default-widgets.php’ is closed to new replies.