> ## Documentation Index
> Fetch the complete documentation index at: https://docs.daftplug.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Hooks

> Every action and filter Crownify exposes, grouped by what it controls.

Add these to your theme's `functions.php` or a site-specific plugin.

Several filters receive a `$context` object describing what is being rendered, so one filter can behave differently on a post, an archive, and the homepage.

Hook names (`rankify_*`), constants (`RANKIFY_*`), and the plugin file `rankify.php` keep the rankify name for backward compatibility.

## Meta output

### rankify\_meta\_title

The final title tag, after templates and per-post overrides.

**\$title** `string` *required*

**\$context** `object`

```php theme={null}
add_filter('rankify_meta_title', function ($title, $context) {
    if (is_search()) {
        return 'Search results';
    }

    return $title;
}, 10, 2);
```

### rankify\_meta\_description

**\$description** `string` *required*

**\$context** `object`

### rankify\_meta\_robots

The robots directives for the current page.

**\$directives** `array` *required*

**\$context** `object`

```php theme={null}
// Noindex anything still carrying a legacy taxonomy term.
add_filter('rankify_meta_robots', function ($directives, $context) {
    if (is_singular('post') && has_term('archived', 'post_tag')) {
        $directives[] = 'noindex';
    }

    return $directives;
}, 10, 2);
```

### rankify\_meta\_canonical

The canonical URL.

**\$canonical** `string` *required*

### rankify\_meta\_image

The social share image.

### rankify\_meta\_separator

The character `%%sep%%` resolves to.

### rankify\_meta\_variable

Resolves a template variable, which is how you add your own.

### rankify\_filter\_document\_title

Whether Crownify takes over WordPress's own title output. Return `false` to leave the theme's title alone.

### Output switches

Three filters turn whole blocks of output off, for when a theme or another plugin should own them.

| Filter | Controls |
| - | - |
| `rankify_output_head_tags` | All head output |
| `rankify_output_schema` | JSON-LD schema |
| `rankify_output_social_tags` | Open Graph and X cards |

```php theme={null}
// Let a page builder own the social tags on one template.
add_filter('rankify_output_social_tags', function ($output) {
    return is_page_template('landing.php') ? false : $output;
});
```

## Schema

### rankify\_schema\_graph

The complete JSON-LD graph before output. The broadest hook in the plugin.

**\$graph** `array` *required*

**\$context** `object`

```php theme={null}
add_filter('rankify_schema_graph', function ($graph, $context) {
    foreach ($graph['@graph'] as &$node) {
        if (($node['@type'] ?? '') === 'Organization') {
            $node['foundingDate'] = '2019-04-01';
        }
    }

    return $graph;
}, 10, 2);
```

### Other schema filters

| Filter | Controls |
| - | - |
| `rankify_schema_types` | Which schema types are offered |
| `rankify_schema_article_types` | Article subtypes available per post type |
| `rankify_schema_page_types` | Page types available |
| `rankify_schema_default_currency` | Currency used in Product markup |
| `rankify_local_business_types` | LocalBusiness subtypes |

### rankify\_metabox\_schema\_panel

Action. Fires inside the editor's schema panel, for adding your own fields.

## Sitemaps and breadcrumbs

| Hook | Type | Controls |
| - | - | - |
| `rankify_sitemap_per_page` | filter | URLs per sitemap page |
| `rankify_sitemap_subtypes` | filter | Which subtypes get their own sitemap |
| `rankify_sitemap_index_extra` | action | Add entries to the sitemap index |
| `rankify_breadcrumb_trail` | filter | The trail as an array, with `$context` |
| `rankify_breadcrumbs_html` | filter | The rendered breadcrumb markup |
| `rankify_archive_disabled` | filter | Whether an archive is disabled |

```php theme={null}
add_filter('rankify_breadcrumb_trail', function ($crumbs, $context) {
    // Drop the blog index from post trails.
    return array_values(array_filter($crumbs, function ($crumb) {
        return $crumb['url'] !== get_permalink(get_option('page_for_posts'));
    }));
}, 10, 2);
```

## AI and answer engines

### rankify\_llms\_txt\_groups

The grouped page list published at `/llms.txt`.

**\$groups** `array` *required*

```php theme={null}
add_filter('rankify_llms_txt_groups', function ($groups) {
    $groups['Support'] = [
        ['title' => 'Contact us', 'url' => home_url('/contact/'), 'summary' => 'How to reach the team.'],
    ];

    return $groups;
});
```

### rankify\_blocked\_ai\_crawlers

Which AI crawlers are blocked in robots.txt.

**\$crawlers** `array` *required*

### rankify\_answer\_source\_content

The content analyzed when generating answer blocks. Use it to strip boilerplate that would otherwise be read as part of an answer.

**\$content** `string` *required*

**\$post** `WP_Post`

### AI tracking

| Filter | Controls |
| - | - |
| `rankify_ai_referral_sources` | Which referrers count as AI referrals |
| `rankify_ai_referral_utm_sources` | Which UTM sources count as AI referrals |
| `rankify_geo_retention_days` | How long crawler and referral data is kept |
| `rankify_trust_proxy_headers` | Whether to trust proxy headers for client IP |

> [!WARNING]
>
> Only enable `rankify_trust_proxy_headers` when your site genuinely sits behind a proxy you control. Trusting these headers otherwise lets any client claim any IP, which defeats crawler identity verification.

### rankify\_indexnow\_submitted

Action. Fires after URLs are submitted to IndexNow.

## Redirects and links

| Hook | Type | Controls |
| - | - | - |
| `rankify_404_ignore_list` | filter | URLs never logged as 404s |
| `rankify_404_log_max_rows` | filter | The hard cap on log size |
| `rankify_link_graph_post_types` | filter | Post types included in link analysis |
| `rankify_orphan_exclusions` | filter | Post IDs never reported as orphans |
| `rankify_redirects_changed` | action | Fires when rules change |
| `rankify_slug_change_redirect` | action | Fires when an automatic redirect is written |

```php theme={null}
add_action('rankify_slug_change_redirect', function ($from, $to) {
    error_log(sprintf('Crownify redirected %s to %s', $from, $to));
}, 10, 2);
```

## Admin and permissions

| Hook | Type | Controls |
| - | - | - |
| `rankify_user_can_edit_meta` | filter | Whether a user may edit SEO fields |
| `rankify_admin_column_post_types` | filter | Which list tables get Crownify columns |
| `rankify_admin_js_vars` | filter | Variables passed to the admin JavaScript |
| `rankify_page_cache_active` | filter | Whether a page cache is considered active |
| `rankify_save_post_meta` | action | Fires when per-post SEO meta is saved |

```php theme={null}
// Let editors manage SEO fields, not just administrators.
add_filter('rankify_user_can_edit_meta', function ($can) {
    return $can || current_user_can('edit_others_posts');
});
```

## Settings and bootstrap

### rankify\_settings\_update:before / :after

Fire around the settings write, both receiving `$settings`.

### rankify\_pro\_loaded

Fires once the Freemius SDK is initialized, before features are constructed.

## Constants

| Constant | Value |
| - | - |
| `RANKIFY_VERSION` | The plugin version string |
| `RANKIFY_FILE` | Absolute path to `rankify.php` |
| `RANKIFY_BASENAME` | Plugin basename |
| `RANKIFY_DIR_PATH` | Absolute path to the plugin directory |
| `RANKIFY_DIR_URL` | URL of the plugin directory |
| `RANKIFY_UPLOAD_DIR` | Absolute path to the plugin's uploads directory |
| `RANKIFY_UPLOAD_URL` | URL of the plugin's uploads directory |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.