Docs / Developers

Hooks

Every filter of GeneratePerf, what it changes and its default, with a ready-to-use example in the child theme.

Every hook below is listed, commented out and with an example, in inc/functions-custom.php of the GeneratePerf child theme: uncomment the one you need and adapt it. The settings screen also shows them in each tab, under Available hooks.

Summary

Filter What it changes Default
generateperf_toc_max_title_level Deepest heading level listed in the table of contents (2 to 6) 4
Filter What it changes Default
generateperf_related_articles_inside_content_limit Maximum number of related posts inserted in the text; short posts get fewer (at least three paragraphs between two) 6
generateperf_related_articles_after_content_limit Number of related posts after the content 6
generateperf_related_articles_sidebar_limit Number of related posts in the sidebar 6
generateperf_related_articles_before_footer_limit Number of related posts before the footer 6
generateperf_related_posts_taxonomies Taxonomies used to find related posts: array taxonomy => terms of the current post tags and categories
generateperf_intext_related_posts_template HTML of a related post inserted in the text; receives the default HTML, the related post and the current post a link with label and title

Social share and authors

Filter What it changes Default
generateperf_social_share_details HTML shown under the title of the share component empty
generateperf_add_user_social_link Social networks of user profiles and of the author box: key => [ name, prefix, icon ]; the icon must be in images/icons/ of the child theme built-in networks
generateperf_trim_author_description Number of words kept in the author description of the author box false (full text)

Design and images

Filter What it changes Default
generateperf_active_fonts Fonts loaded by GeneratePerf (stylesheet, preload of the variable file, block editor): catalogue stacks (Poppins, Poppins-fallback, sans-serif) or family names (Poppins); return an empty array to load none fonts of the GeneratePress typography and of the GenerateBlocks Global Styles
generateperf_layout_custom_border_radius Border radius of buttons, fields and cards (CSS variable --border-radius) Design → Border radius
generateperf_max_image_size Largest size kept for uploaded images, in pixels; the WordPress sizes above it are not generated 1200

Performance

Filter What it changes Default
generateperf_css_concatenation Whether stylesheets are kept as files for a concatenation tool: true sets the WordPress inline limit (styles_inline_size_limit) to 0, false keeps the WordPress limit, so small stylesheets (fonts, GeneratePerf, GeneratePress, GP Premium, GenerateBlocks Pro, the child theme, WP Armour) are printed in the page instead of blocking it; receives the detected value and the slug of the tool true only when a CSS concatenation setting is active: WP Rocket before 3.15, Autoptimize, LiteSpeed Cache, SiteGround Speed Optimizer, W3 Total Cache, WP-Optimize, Breeze, WP Fastest Cache, Jetpack Boost

robots.txt

Filter What it changes Default
generateperf_list_block_agents User agents blocked (Disallow: /); applied last, so it overrides the AI crawlers setting the AI crawlers of the level set in SEO → AI crawlers
generateperf_ai_bots AI crawlers of each category: [ 'training' => [...], 'inference' => [...] ] list maintained with each release
generateperf_content_signal Value of the Content-Signal directive (usage preference declared in the User-agent: * group); receives the value and the level, an empty string removes it search=yes, ai-input=yes, ai-train=no (training only), search=yes, ai-input=no, ai-train=no (training and inference), none (none)
generateperf_list_bot_agents User agents with a limited crawl rate (Crawl-delay: 180) SEO tools and aggressive crawlers

The AI crawlers setting (SEO tab) picks the level: none, training only (default for new installs) or training and inference. Training crawlers (GPTBot, ClaudeBot, CCBot, Google-Extended, Applebot-Extended, Meta-ExternalAgent, Amazonbot…) collect pages to train models; inference crawlers (OAI-SearchBot, ChatGPT-User, Claude-SearchBot, PerplexityBot…) fetch them to cite the site in answers. Sites installed before 3.1.4 keep the level « none ». With Yoast SEO active, the rules are written in the Yoast block of robots.txt; otherwise GeneratePerf adds them itself.

Example

// inc/functions-custom.php of the child theme: list h2 and h3 only in the table of contents
add_filter( 'generateperf_toc_max_title_level', function () {
    return 3;
} );