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_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

robots.txt

Filter What it changes Default
generateperf_list_block_agents User agents blocked (Disallow: /) Amazonbot, cohere-ai, FacebookBot, Omgilibot
generateperf_list_bot_agents User agents with a limited crawl rate (Crawl-delay: 180) SEO tools and aggressive crawlers

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;
} );