 */
function taico_excerpt_chars($post_id = 0, $len = 200) {
  $post_id = $post_id ?: get_the_ID();

  // 手動抜粋があればそれを優先
  $text = get_post_field('post_excerpt', $post_id);
  if (!$text) {
    $text = get_post_field('post_content', $post_id);
  }

  $text = strip_shortcodes($text);
  $text = wp_strip_all_tags($text, true);
  $text = trim(preg_replace('/\s+/u', ' ', $text));

  // 文字数で安全に切る（CJKでも暴走しない）
  if (function_exists('mb_strlen') && mb_strlen($text, 'UTF-8') > $len) {
    $text = mb_substr($text, 0, $len, 'UTF-8') . '…';
  } else {
    // mb_* が無い環境の保険
    $text = wp_html_excerpt($text, $len, '…');
  }

  return $text;
}

/**
 * Head cleanup (safe)
 */

// ---------------------------
// 1) Emoji stop
// ---------------------------
add_action('init', function () {
  remove_action('wp_head', 'print_emoji_detection_script', 7);
  remove_action('admin_print_scripts', 'print_emoji_detection_script');
  remove_action('wp_print_styles', 'print_emoji_styles');
  remove_action('admin_print_styles', 'print_emoji_styles');
  remove_filter('the_content_feed', 'wp_staticize_emoji');
  remove_filter('comment_text_rss', 'wp_staticize_emoji');
  remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
});

// enqueueされた絵文字CSSが残る環境対策
add_action('wp_enqueue_scripts', function () {
  wp_dequeue_style('wp-emoji-styles');
}, 100);

// ---------------------------
// 2) Remove unnecessary head tags
// ---------------------------
add_action('init', function () {
  remove_action('wp_head', 'rsd_link');
  remove_action('wp_head', 'wlwmanifest_link');
  remove_action('wp_head', 'wp_generator');
  // feed
  remove_action('wp_head', 'feed_links', 2);
  remove_action('wp_head', 'feed_links_extra', 3);
  // adjacent
  remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
  // shortlink
  remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
  // REST / oEmbed discovery links (機能自体は止まらない)
  remove_action('wp_head', 'rest_output_link_wp_head');
  remove_action('template_redirect', 'rest_output_link_header', 11);
  remove_action('wp_head', 'wp_oembed_add_discovery_links');
  remove_action('wp_head', 'wp_oembed_add_host_js');
  // remove_action('wp_head', 'rel_canonical');
});

// ---------------------------
// 3) Block editor generated styles cleanup
// ---------------------------
add_action('wp_enqueue_scripts', function () {
  if (is_singular('post')) {
    wp_dequeue_style('classic-theme-styles');
    return;
  }
  wp_dequeue_style('global-styles');
  wp_dequeue_style('classic-theme-styles');
}, 100);

// SVG filters (場合により)
add_action('init', function () {
  remove_action('wp_body_open', 'wp_global_styles_render_svg_filters');
});

// ---------------------------
//投稿者アーカイブを完全に無効化
// ---------------------------
add_action('template_redirect', function () {
    if (is_author()) {
        wp_redirect(home_url('/'), 301);
        exit;
    }
});
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//japarenguam.com/main-sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc>https://japarenguam.com/post-sitemap1.xml</loc>
		<lastmod>2026-03-26T08:12:30+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://japarenguam.com/post-sitemap2.xml</loc>
		<lastmod>2026-03-26T08:12:07+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://japarenguam.com/page-sitemap.xml</loc>
		<lastmod>2026-08-31T00:26:30+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://japarenguam.com/category-sitemap.xml</loc>
		<lastmod>2026-03-06T04:21:43+00:00</lastmod>
	</sitemap>
</sitemapindex>
<!-- XML Sitemap generated by Rank Math SEO Plugin (c) Rank Math - rankmath.com -->