Overview
Enable debug HTML comments showing JSON-LD processing steps.
Description
This filter enables debug mode for JSON-LD output. When enabled, ACF outputs HTML comments showing each step of the JSON-LD processing, including which post types are checked, which fields are found, and why output may be skipped.
This is useful for troubleshooting when JSON-LD is not appearing as expected.
Changelog
- Added in version 6.8.0
Parameters
apply_filters( 'acf/schema/debug', $debug );
$debug(bool) Whether to output debug comments. Default:false
Return
(bool) Whether debug mode is enabled.
Example
This example enables debug mode.
add_filter( 'acf/schema/debug', '__return_true' );
This example enables debug mode only for administrators.
/**
* Enable JSON-LD debug mode for admins only.
*
* @param bool $debug Whether debug mode is enabled.
* @return bool Modified debug setting.
*/
function my_acf_schema_debug_for_admins( $debug ) {
if ( current_user_can( 'manage_options' ) ) {
return true;
}
return $debug;
}
add_filter( 'acf/schema/debug', 'my_acf_schema_debug_for_admins' );
Debug Output
When enabled, you’ll see HTML comments like:
<!-- ACF AI JSON-LD: Checking post type: recipe -->
<!-- ACF AI JSON-LD: Found 8 ACF fields -->
<!-- ACF AI JSON-LD: Processing field 'prep_time' with schema_property 'prepTime' -->
Or when output is skipped:
<!-- ACF AI JSON-LD: Post type 'post' does not have JSON-LD enabled -->
Supercharge Your Website With Premium Features Using ACF PRO
Speed up your workflow and unlock features to better develop websites using ACF Blocks and Options Pages, with the Flexible Content, Repeater, Clone, Gallery Fields & More.
Related
- Filters: acf/schema/block_jsonld_enabled
- Features: Structured Data for ACF Blocks
- Filters: acf/schema/post_field_objects
- Filters: acf/schema/block_field_objects
- Filters: acf/schema/auto_add_image