' . "\n";
echo '' . "\n";
}
add_action('wp_head', 'roi_prefetch_external', 1);
/**
* Open Graph support for Rank Math compatibility
*
* Ensures theme doesn't output conflicting OG tags when Rank Math is active.
* Rank Math handles all Open Graph implementation.
*
* @since 1.0.0
*/
function roi_check_rank_math_active() {
return defined('RANK_MATH_VERSION');
}
/**
* Schema.org compatibility layer
*
* Provides basic schema support if Rank Math is not active.
* When Rank Math is active, it takes over all schema implementation.
*
* @since 1.0.0
*/
function roi_schema_fallback() {
// Only output schema if Rank Math is NOT active
if (roi_check_rank_math_active()) {
return;
}
// Basic organization schema fallback
$schema = array(
'@context' => 'https://schema.org',
'@type' => 'WebSite',
'name' => get_bloginfo('name'),
'url' => get_home_url(),
);
if (get_bloginfo('description')) {
$schema['description'] = get_bloginfo('description');
}
echo "\n" . '' . "\n";
echo '' . "\n";
}
add_action('wp_head', 'roi_schema_fallback', 20);
/**
* Security headers configuration
*
* Adds recommended security headers that also improve SEO
* (by indicating secure, well-maintained site)
*
* @since 1.0.0
*/
function roi_security_headers() {
// These headers improve trust signals for search engines
header('X-Content-Type-Options: nosniff');
header('X-Frame-Options: SAMEORIGIN');
header('X-XSS-Protection: 1; mode=block');
}
add_action('send_headers', 'roi_security_headers');
/**
* Ensure title tag support is active
*
* This is set in functions.php with add_theme_support('title-tag')
* but we verify it here to log any issues for debugging.
*
* @since 1.0.0
*/
function roi_verify_title_tag_support() {
if (!current_theme_supports('title-tag')) {
// Log warning if title-tag support is somehow disabled
error_log('Warning: ROI Theme title-tag support not properly initialized');
}
}
add_action('after_setup_theme', 'roi_verify_title_tag_support', 20);