Home Forums WoodMart support forum PHP Fatal error in root of /wp-content/themes/index.php:11

PHP Fatal error in root of /wp-content/themes/index.php:11

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #537575

    av_admin_1984
    Participant

    Hello

    Everye week I got this error

    [03-Feb-2024 20:34:33 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function get_header() in /home/site/public_html/wp-content/themes/index.php:11
    Stack trace:
    #0 {main}
      thrown in /home/site/public_html/wp-content/themes/index.php on line 11

    and in my root of /public_html/wp-content/themes/ there is an index.php file and inside that file is :

    <?php
    /**
     * The main template file
     */
    
    if( function_exists( 'woodmart_is_woo_ajax' ) && woodmart_is_woo_ajax() ) {
    	do_action( 'woodmart_main_loop' );
    	die();
    }
    
    get_header(); ?>
    
    <?php 
    
    	// Get content width and sidebar position
    	$content_class = woodmart_get_content_class();
    
    ?>
    
    <div class="site-content <?php echo esc_attr( $content_class ); ?>" role="main">
    
    	<?php do_action( 'woodmart_main_loop' ); ?>
    
    </div><!-- .site-content -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    Where is coming?
    Should I remove this file?

    This is line 11
    get_header(); ?>

    #537603

    Artem Temos
    Keymaster

    Hello,

    This function is a core WordPress function and your error says that it is missing which is impossible. Most likely, somebody tried to open this file in the browser.

    Kind Regards

    #537630

    av_admin_1984
    Participant

    1- Is it safe to remove that index.php?
    2-

    Most likely, somebody tried to open this file in the browser.

    How? Could you please give me the path of this file for the browser?
    3-in index.php file I see this code:

    if( function_exists( 'woodmart_is_woo_ajax' ) && woodmart_is_woo_ajax() ) {
    	do_action( 'woodmart_main_loop' );
    	die();
    }
    
    get_header(); ?>
    
    <?php 
    
    	// Get content width and sidebar position
    	$content_class = woodmart_get_content_class();
    
    ?>
    
    <div class="site-content <?php echo esc_attr( $content_class ); ?>" role="main">
    
    	<?php do_action( 'woodmart_main_loop' ); ?>
    
    </div><!-- .site-content -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    Those codes mentioned to woodmart, it that right?

    #537674

    Artem Temos
    Keymaster

    1. 3. Our theme doesn’t create that file. Most likely you copied it there accidentally.

    2. We don’t know how since this error appears on your website only.

    Kind Regards

    #537731

    av_admin_1984
    Participant

    Fine,

    I removed that file,

    Please close this topic

    Thanks

    #537735

    Artem Temos
    Keymaster

    You are welcome. Feel free to contact us if you have any further questions.

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