/**
* ============================================================
* FIX: Remove duplicated content appearing before site header
* ============================================================
*/
add_action( 'template_redirect', 'growequal_remove_duplicate_header_content', 1 );
function growequal_remove_duplicate_header_content() {
// Admin/backend ko affect mat karo
if ( is_admin() ) {
return;
}
// AJAX / REST ko affect mat karo
if ( wp_doing_ajax() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) {
return;
}
// Sirf frontend HTML pages
if ( is_feed() || is_robots() || is_trackback() ) {
return;
}
ob_start( 'growequal_clean_duplicate_header_output' );
}
/**
* Clean unwanted duplicate content from final HTML output.
*/
function growequal_clean_duplicate_header_output( $html ) {
if ( empty( $html ) || ! is_string( $html ) ) {
return $html;
}
/*
* --------------------------------------------------------
* 1. Remove the exact Baby Cream duplicate text
* --------------------------------------------------------
*/
$duplicate_text = 'Baby Cream Manufacturer in Ahmedabad, Supplying Across India';
if ( strpos( $html, $duplicate_text ) !== false ) {
/*
* Find all occurrences.
* Keep the last occurrence because that should be
* the actual page content.
*/
$first_position = strpos( $html, $duplicate_text );
$last_position = strrpos( $html, $duplicate_text );
if ( $first_position !== false && $last_position !== false && $first_position !== $last_position ) {
/*
* Remove only the first duplicate occurrence.
*/
$before = substr( $html, 0, $first_position );
$after = substr( $html, $first_position + strlen( $duplicate_text ) );
$html = $before . $after;
}
}
/*
* --------------------------------------------------------
* 2. Remove malformed standalone /> left by duplicate
* --------------------------------------------------------
*/
$html = preg_replace(
'/(
]*>\s*)(?:\s*\/>\s*)+/i',
'$1',
$html
);
/*
* --------------------------------------------------------
* 3. Clean duplicate product heading if it appears
* immediately before the real page/header content.
* --------------------------------------------------------
*/
if ( is_singular() ) {
$title = get_the_title();
if ( ! empty( $title ) ) {
$title_pattern = preg_quote( wp_strip_all_tags( $title ), '/' );
/*
* Remove a plain duplicate title occurring directly
* before the main page wrapper.
*/
$html = preg_replace(
'/(' . $title_pattern . '){2,}/i',
'$1',
$html,
1
);
}
}
return $html;
}
Growequal Limited at IPHEX 2025 Pharma Nutraceutical Expo
IPHEX New Delhi Expo 2026
Home Events IPHEX New Delhi Expo 2026