---
title: Citelayer® Hooks &amp; Filters Reference — WordPress Developer Guide — citelayer®
url: https://citelayer.ai/docs/hooks-filters/
date: 2026-02-25
---

# Citelayer® Hooks &amp; Filters Reference — WordPress Developer Guide

Citelayer® exposes a comprehensive set of WordPress filters that let you customize every output — from structured data schemas to llms.txt content and protocol responses. Each filter follows standard WordPress conventions and receives well-documented parameters.

All filters listed on this page are available since **version 0.3.0**. For endpoint-level documentation, see the [REST API Reference](/docs/rest-api/).

Schema Filters
--------------

These filters let you modify the JSON-LD structured data that Citelayer® injects into your pages. Use them to add properties, change types, or extend the schema graph. For an overview of how Citelayer® generates schema markup, see [Schema &amp; Structured Data](/docs/schema-json-ld/).

### `citelayer_organization_schema`

Filters the Organization schema array before Citelayer® outputs it as JSON-LD. Use this filter to add social profiles, contact information, or change the organization type.

#### Parameters

ParameterTypeDescription`$schema``array`Organization schema data including `@type`, `name`, `url`, and all configured properties.**Source:** `Schema.php` line 312  
**Since:** 0.3.0

```
add_filter( 'citelayer_organization_schema', 'my_customize_organization_schema' );

function my_customize_organization_schema( $schema ) {
	// Add social profile links.
	$schema['sameAs'] = array(
		'https://twitter.com/yourhandle',
		'https://www.linkedin.com/company/yourcompany',
		'https://github.com/yourorg',
	);

	// Add a contact point.
	$schema['contactPoint'] = array(
		'@type'       => 'ContactPoint',
		'telephone'   => '+1-800-555-0199',
		'contactType' => 'customer service',
		'areaServed'  => 'US',
	);

	// Change to a more specific organization type.
	$schema['@type'] = 'Corporation';

	return $schema;
}
```

### `citelayer_website_schema`

Filters the WebSite schema array before output. Use this filter to customize the search action, add alternative names, or modify site-level structured data.

#### Parameters

ParameterTypeDescription`$schema``array`WebSite schema data including `@type`, `url`, `name`, `publisher`, and `potentialAction`.**Source:** `Schema.php` line 364  
**Since:** 0.3.0

```
add_filter( 'citelayer_website_schema', 'my_customize_website_schema' );

function my_customize_website_schema( $schema ) {
	// Add an alternative site name.
	$schema['alternateName'] = 'YS';

	// Add a custom SearchAction targeting a specific search page.
	$schema['potentialAction'] = array(
		'@type'       => 'SearchAction',
		'target'      => array(
			'@type'       => 'EntryPoint',
			'urlTemplate' => home_url( '/search/{search_term_string}' ),
		),
		'query-input' => 'required name=search_term_string',
	);

	return $schema;
}
```

### `citelayer_article_schema`

Filters the Article or BlogPosting schema for individual posts. This filter receives both the schema array and the `WP_Post` object, so you can conditionally modify schema based on post type, category, or custom fields.

#### Parameters

ParameterTypeDescription`$schema``array`Article/BlogPosting schema data for the current post.`$post``WP_Post`The WordPress post object being rendered.**Source:** `Schema.php` line 434  
**Since:** 0.3.0

```
add_filter( 'citelayer_article_schema', 'my_customize_article_schema', 10, 2 );

function my_customize_article_schema( $schema, $post ) {
	// Use TechArticle for posts in the "tutorials" category.
	if ( has_category( 'tutorials', $post ) ) {
		$schema['@type'] = 'TechArticle';
		$schema['proficiencyLevel'] = 'Beginner';
	}

	// Add a custom citation from a meta field.
	$citation = get_post_meta( $post->ID, '_article_citation', true );
	if ( $citation ) {
		$schema['citation'] = $citation;
	}

	// Add word count.
	$schema['wordCount'] = str_word_count( wp_strip_all_tags( $post->post_content ) );

	return $schema;
}
```

Content &amp; Protocol Filters
------------------------------

These filters let you customize the content Citelayer® generates for AI-facing protocols. For feature overviews, see [llms.txt](/docs/llms-txt/), [WebMCP](/docs/webmcp/), and [UCP](/docs/ucp-discovery/).

### `citelayer_llmstxt_content`

Filters the llms.txt content before Citelayer® outputs it. **Important:** this filter receives an *array of lines* (strings), not a single string. Each element represents one line in the final output.

#### Parameters

ParameterTypeDescription`$content``array`Array of content lines (strings). Each element becomes one line in the output.**Source:** `LLMS_TXT.php` line 262  
**Since:** 0.3.0

```
add_filter( 'citelayer_llmstxt_content', 'my_customize_llmstxt' );

function my_customize_llmstxt( $content ) {
	// Add a custom section at the end.
	$content[] = '';
	$content[] = '## API Documentation';
	$content[] = '- [REST API Reference](https://yoursite.com/docs/api/)';
	$content[] = '- [Webhooks Guide](https://yoursite.com/docs/webhooks/)';

	// Remove lines containing a specific URL.
	$content = array_filter( $content, function ( $line ) {
		return strpos( $line, '/internal-draft/' ) === false;
	} );

	// Re-index the array after filtering.
	$content = array_values( $content );

	return $content;
}
```

### `citelayer_webmcp_context`

Filters the full WebMCP context data before Citelayer® serves it at `/.well-known/mcp/context.json`. Use this filter to add custom capabilities, modify the endpoint list, or inject metadata. See [WebMCP](/docs/webmcp/) for protocol details.

#### Parameters

ParameterTypeDescription`$context``array`Full WebMCP context data including site info, capabilities, and endpoints.**Source:** `WebMCP.php` line 145  
**Since:** 0.3.0

```
add_filter( 'citelayer_webmcp_context', 'my_customize_webmcp_context' );

function my_customize_webmcp_context( $context ) {
	// Add a custom capability.
	if ( isset( $context['capabilities'] ) ) {
		$context['capabilities']['custom_search'] = true;
	}

	// Add custom metadata.
	$context['metadata'] = array(
		'support_email' => 'dev@yoursite.com',
		'api_version'   => '2.1',
	);

	return $context;
}
```

### `citelayer_ucp_discovery_response`

Filters the UCP (Unified Commerce Protocol) discovery response before Citelayer® returns it. Use this filter to add custom capabilities or modify shop information. See [UCP Commerce Protocol](/docs/ucp-discovery/) for protocol details.

#### Parameters

ParameterTypeDescription`$response_data``array`UCP discovery response including `protocol`, `version`, `shop`, and `capabilities`.**Source:** `UCP_Discovery.php` line 115  
**Since:** 0.3.0

```
add_filter( 'citelayer_ucp_discovery_response', 'my_customize_ucp_discovery' );

function my_customize_ucp_discovery( $response_data ) {
	// Add custom shop metadata.
	$response_data['shop']['industry']       = 'Electronics';
	$response_data['shop']['currency']       = 'EUR';
	$response_data['shop']['shipping_zones'] = array( 'EU', 'US', 'UK' );

	// Override capabilities if your integration supports them.
	$response_data['capabilities']['product_browsing'] = true;

	return $response_data;
}
```

Compatibility Filters
---------------------

Citelayer® automatically detects third-party SEO plugins and manages feature conflicts. These filters let you override detection results and conflict resolution. See [SEO Plugin Compatibility](/docs/seo-compatibility/) for background.

### `citelayer_detected_seo_plugins`

Filters the array of detected SEO plugin slugs. Use this filter to force-add a custom or private SEO plugin that Citelayer® doesn’t detect automatically, or to exclude a plugin from detection results.

#### Parameters

ParameterTypeDescription`$plugins``array`Array of detected plugin slugs (e.g., `array( 'yoast-seo', 'rank-math' )`).**Source:** `Compatibility.php` line 380  
**Since:** 0.3.0

```
add_filter( 'citelayer_detected_seo_plugins', 'my_customize_seo_detection' );

function my_customize_seo_detection( $plugins ) {
	// Force-add a custom SEO plugin so Citelayer® recognizes it.
	$plugins[] = 'my-custom-seo-plugin';

	// Exclude a plugin from detection (treat it as not installed).
	$plugins = array_diff( $plugins, array( 'all-in-one-seo-pack' ) );

	return array_values( $plugins );
}
```

### `citelayer_feature_conflicts`

Overrides conflict detection for specific feature and plugin combinations. Citelayer® checks whether a feature (like schema output) conflicts with an active SEO plugin. Use this filter to force a feature on or off regardless of the default detection logic.

#### Parameters

ParameterTypeDescription`$conflicts``bool``true` if Citelayer® detected a conflict, `false` otherwise.`$feature``string`The feature being checked (e.g., `'schema'`, `'meta_tags'`).`$plugin``string`The plugin slug that triggered the conflict check.**Source:** `Compatibility.php` line 601  
**Since:** 0.3.0

```
add_filter( 'citelayer_feature_conflicts', 'my_override_feature_conflicts', 10, 3 );

function my_override_feature_conflicts( $conflicts, $feature, $plugin ) {
	// Allow Citelayer® schema output even when Yoast SEO is active.
	if ( 'schema' === $feature && 'yoast-seo' === $plugin ) {
		return false;
	}

	// Force-disable a feature for a specific plugin.
	if ( 'meta_tags' === $feature && 'rank-math' === $plugin ) {
		return true;
	}

	return $conflicts;
}
```

Best Practices
--------------

- **Always return the filtered value.** Every filter callback must return the modified (or unmodified) data. Forgetting the `return` statement silently breaks output.
- **Use the correct number of accepted arguments.** Filters like `citelayer_article_schema` and `citelayer_feature_conflicts` pass multiple parameters. Declare the argument count in `add_filter()` (e.g., `10, 2` or `10, 3`).
- **Place filter code in your theme’s `functions.php` or a custom plugin.** Avoid editing Citelayer® files directly — updates will overwrite your changes.
- **Test with `WP_DEBUG` enabled.** Schema output errors appear in the debug log and help you catch malformed data early.
- **Validate schema changes.** After modifying schema filters, test your pages with [Google’s Schema Validator](https://validator.schema.org/) to ensure valid JSON-LD.

Related Documentation
---------------------

- [REST API Reference](/docs/rest-api/) — Endpoint documentation for programmatic access
- [Schema &amp; Structured Data](/docs/schema-json-ld/) — How Citelayer® generates JSON-LD
- [llms.txt for WordPress](/docs/llms-txt/) — AI-readable site summaries
- [WebMCP Context Discovery](/docs/webmcp/) — Machine-readable site capabilities
- [UCP Commerce Protocol](/docs/ucp-discovery/) — Unified Commerce Protocol for WooCommerce
- [Markdown Content Endpoint](/docs/markdown-for-agents/) — Per-post markdown output
- [SEO Plugin Compatibility](/docs/seo-compatibility/) — Conflict detection and resolution

citelayer\_bot\_analytics\_cleanup\_days
----------------------------------------

Controls bot visit retention. `$days` (int), default 90.

```
add_filter( 'citelayer_bot_analytics_cleanup_days', function( $days ) {
    return 180;
} );
```

citelayer\_product\_feed\_max\_items
------------------------------------

Max products in XML feed. `$max` (int), default 1000.

```
add_filter( 'citelayer_product_feed_max_items', function( $max ) {
    return 2500;
} );
```
