Create New Item
×
Item Type
File
Folder
Item Name
×
Search file in folder and subfolders...
File Manager
/
wp-content
/
plugins
/
wp-rocket
/
inc
/
3rd-party
/
plugins
/
seo
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php defined('ABSPATH') || exit; if (defined('WPSEO_VERSION') && class_exists('WPSEO_Sitemaps_Router')) { $yoast_seo_xml = get_option('wpseo_xml'); if (version_compare(WPSEO_VERSION, '7.0') >= 0) { $yoast_seo = get_option('wpseo'); $yoast_seo_xml['enablexmlsitemap'] = isset($yoast_seo['enable_xml_sitemap']) && $yoast_seo['enable_xml_sitemap']; } if (true === $yoast_seo_xml['enablexmlsitemap']) { function rocket_add_yoast_seo_sitemap_option($options) { $options['yoast_xml_sitemap'] = 0; return $options; } add_filter('rocket_first_install_options', 'rocket_add_yoast_seo_sitemap_option'); function rocket_yoast_seo_sitemap_option_sanitize($inputs) { $inputs['yoast_xml_sitemap'] = !empty($inputs['yoast_xml_sitemap']) ? 1 : 0; return $inputs; } add_filter('rocket_inputs_sanitize', 'rocket_yoast_seo_sitemap_option_sanitize'); function rocket_add_yoast_seo_sitemap($sitemaps) { if (get_rocket_option('yoast_xml_sitemap', false)) { $sitemaps[] = WPSEO_Sitemaps_Router::get_base_url('sitemap_index.xml'); } return $sitemaps; } add_filter('rocket_sitemap_preload_list', 'rocket_add_yoast_seo_sitemap'); function rocket_sitemap_preload_yoast_seo_option($options) { $options['yoast_xml_sitemap'] = ['type' => 'checkbox', 'container_class' => ['wpr-field--children'], 'label' => __('Yoast SEO XML sitemap', 'rocket'), 'description' => sprintf(__('We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket'), 'Yoast SEO'), 'parent' => 'sitemap_preload', 'section' => 'preload_section', 'page' => 'preload', 'default' => 0, 'sanitize_callback' => 'sanitize_checkbox']; return $options; } add_filter('rocket_sitemap_preload_options', 'rocket_sitemap_preload_yoast_seo_option'); } }