- Installing SureRank
- SureRank Onboarding Guide
- How to Activate Your SureRank Pro License
- SureRank Dashboard Overview
- General Settings
- Advanced Settings
- Search Console – SureRank
- Managing URL Redirection in SureRank
- SureRank Feature Management – Quick Guide
- Robots.txt Feature in SureRank
- Sitemaps in SureRank
- How to Enable Video Sitemap in SureRank Pro
- How to Enable the News Sitemap in SureRank
- How to Show the HTML Sitemap on Your Site in SureRank Pro
- How to Regenerate the Sitemap After Excluding a Post Type in SureRank
- Change the Sitemap URL in SureRank
- How to Enable Author Sitemap in SureRank
- How to Fix WWW and Non-WWW Version Redirects to Improve Your SEO
- How to Fix: No H1 Heading Found on Your Homepage
- How to Fix Missing H2 Headings on Your Homepage
- Re-run Checks Button in SureRank
- Fix Critical Error: Another SEO Plugin Detected in SureRank
- Fix Warning: Site Tagline Is Not Set in SureRank
- How to Fix Multiple SEO Plugins Detected on Your Site
- How to Fix: Homepage is Not Indexable by Search Engines
- Warning: Homepage Does Not Contain Internal Links
- How to Fix Missing Alt Text on Homepage Images
- How to Fix: Search Engine Title is Missing on the Page
- Page Level SEO: Broken Links Detected
- How to Fix Missing Alt Text on Images
- How to Fix Page URLs That Are Too Long
- Page Level SEO Warning: No Links Found on This Page
- Page Level SEO Warning: No Images or Videos Found
- Page Level SEO Warning: Missing Search Engine Description
- Page Level SEO Warning: No Subheadings Found on This Page
- Page Level SEO Warning: Canonical Tag is Missing
- Page Level SEO Warning: Open Graph Tags Missing
- What is Google Search Console and how does SureRank use it?
- Recommended Image Sizes
- SureRank – SEO Check Severity Guide
- Using SureRank with Other SEO Plugins – Best Practices
- Import/Export Feature – SureRank Plugin
- What is llms.txt and Does SureRank Support It?
- Does SureRank offer a keyword rank-tracking feature?
- Does SureRank Come With Google Analytics Integration?
- Email Summary in SureRank
- SureRank Role Manager
- Customize XML Sitemap Top Bar with surerank_sitemap_top_bar_data
- Analyze ACF Field Content with SureRank
- Preserve Modified Date During Updates surerank_freeze_modified_date
- Customize Final Title Tag surerank_final_title
- Customize Post Type Archive Title Output surerank_post_type_archive_title
- Customize Archive Page Title with surerank_archive_title
- CustomizeModify the Search Results Page Title surerank_search_title
- Customizing the 404 Page Title surerank_not_found_title
- Customizing the Title Separator surerank_title_separator
- How to Remove Archive Prefixes from Titles Using SureRank
- Customize Homepage Pagination Format surerank_homepage_pagination_format
- Customize Maximum SEO Title Length surerank_title_length
- Enable/Disable Pagination in SureRank Archives surerank_show_pagination
- Show or Hide Site Name in SEO Title surerank_show_site_name
- Customize Robots Meta Tags surerank_robots_meta_array
- Add “noindex” to Paginated Pages surerank_noindex_paginated_pages
- Customize Meta Description Length surerank_description_length
- Customize Product Category Rewrite Rules surerank_product_category_rewrite_rules
- Remove Product Category Base surerank_remove_product_category_base
- Customize Category URL Structure surerank_remove_category_base
- Disable Permalinks in RSS Feeds surerank_disable_permalink_in_feed
- Customize Maximum URL Slug Length surerank_url_length
- Disable Feed Indexing in SureRank surerank_disable_feed_indexing
- Open External Links in New Tab
Analyze ACF Field Content with SureRank
If your theme stores page content in ACF fields and bypasses the_content(), SureRank reads an empty post_content and cannot analyze headings, images, or keyword density. Use this filter to fix that.
Hook: surerank_post_analyzer_content
Description: This filter lets you replace or extend the content string that SureRank’s page SEO analyzer reads. Use it to feed Advanced Custom Fields (ACF) data, custom table values, or any external content source into the analyzer when your theme does not use the default post_content field.
Source: inc/analyzer/post-analyzer.php
Usage
Use this filter when your theme stores page content in ACF fields and bypasses the_content() entirely. Without it, the analyzer reads an empty post_content string and cannot grade headings, images, links, or keyword density.
| Note: The analyzer runs XPath queries (//h2, //img, //a[@href]) against the content string. Structural checks only fire when the content contains real HTML tags. Plain text is sufficient for keyword and word-count checks only. |
Example
The snippet below appends ACF field content as properly structured HTML so all SEO checks can run against it. Save it as a mu-plugin or add it to your child theme’s functions.php.
<?php
/**
* Feed ACF field content into SureRank's analyzer as HTML
* so XPath checks (//h2, //img, //a) can see it.
*
* Save as: wp-content/mu-plugins/surerank-acf-bridge.php
*/
add_filter( 'surerank_post_analyzer_content', function ( $content, $post ) {
if ( ! function_exists( 'get_field_objects' ) ) {
return $content;
}
$fields = get_field_objects( $post->ID );
if ( empty( $fields ) ) {
return $content;
}
// Map ACF field names to heading levels. Adjust to match your field group.
$heading_map = [
'hero_title' => 'h1',
'section_title' => 'h2',
'sub_title' => 'h3',
];
$extra = [];
foreach ( $fields as $name => $field ) {
$value = $field['value'] ?? '';
$type = $field['type'] ?? '';
if ( isset( $heading_map[ $name ] ) && is_string( $value ) && $value !== '' ) {
$tag = $heading_map[ $name ];
$extra[] = '<' . $tag . '>' . esc_html( $value ) . '</' . $tag . '>';
continue;
}
if ( $type === 'wysiwyg' && is_string( $value ) ) {
$extra[] = $value;
continue;
}
if ( in_array( $type, [ 'text', 'textarea' ], true ) && is_string( $value ) && $value !== '' ) {
$extra[] = '<p>' . esc_html( $value ) . '</p>';
continue;
}
if ( $type === 'image' && is_array( $value ) && ! empty( $value['url'] ) ) {
$extra[] = sprintf(
'<img src="%s" alt="%s" />',
esc_url( $value['url'] ),
esc_attr( $value['alt'] ?? '' )
);
continue;
}
if ( $type === 'link' && is_array( $value ) && ! empty( $value['url'] ) ) {
$extra[] = sprintf(
'<a href="%s">%s</a>',
esc_url( $value['url'] ),
esc_html( $value['title'] ?? $value['url'] )
);
continue;
}
}
return $content . "\n" . implode( "\n", $extra );
}, 10, 2 );Where to Add the Code
You can add the example code to your child theme’s functions.php file or save it as wp-content/mu-plugins/surerank-acf-bridge.php. Using a mu-plugin is recommended because it stays active regardless of which theme is active.
Available Parameters
- $content: The current content string passed to the analyzer. By default, this is $post->post_content.
- $post: The full WP_Post object for the post being analyzed. Use it to branch logic per post type or template.
Required Customization
The $heading_map array must be updated to match your actual ACF field names and their intended heading levels. Without this, the analyzer cannot determine which fields represent h1, h2, or h3 elements, and heading checks will not pass.
// Replace these keys with your actual ACF field names
$heading_map = [
'hero_title' => 'h1',
'section_title' => 'h2',
'sub_title' => 'h3',
];Notes
- Repeater fields and flexible-content layouts are not walked by this snippet. A have_rows() / get_sub_field() loop tailored to your field group structure is needed for those.
- ACF WYSIWYG values are stored raw. If your theme uses shortcodes inside WYSIWYG fields, wrap the value with do_shortcode( $value ) before pushing to $extra.
- All field values are escaped with esc_html, esc_attr, and esc_url before being passed in to prevent malformed HTML from corrupting the DOMDocument parse.
- The filter runs only when the SEO panel is open or a check is recalculated. There is no impact on the front-end page load.
- This filter does not affect sitemap generation, schema output, or any other part of SureRank outside of the page SEO analyzer.
We don't respond to the article feedback, we use it to improve our support content.