Search Flexible Modules
The Custom_Search_Modules
class provides a clear and structured way to visualize which ACF (Advanced Custom Fields) flexible modules are being used on each page of a WordPress site. This tool is particularly useful in projects that rely on flexible content fields to build dynamic pages, making it easier to audit and locate modules such as heros or modules across all published content.
The class performs a full scan across all public post types on the site and generates tables that cross-reference modules with the pages they appear on, marking each match with a checkmark (✔️
). This helps designers, developers, and editors quickly understand where and how reusable content components are being used, improving the site’s maintainability and consistency.
Key Features
Section titled “Key Features”filtered_content()
– Extracts modules used on a page for a given flexible content field.show_custom_search_module()
– Displays an interactive table listing modules and the pages they appear on.filtered_heading()
– Filters and alphabetically sorts page titles associated with modules.create_table()
– Generates an HTML table to visualize module usage across pages.
This utility is ideal for teams working with modular WordPress structures who need a high-level overview of how ACF components are distributed throughout the site.
You can find the full class implementation here.
Example Usage
Section titled “Example Usage”<?php
// Instantiate the Custom_Search_Modules class, for now withoyt required parameters.new Custom_Search_Modules((object) array());
?>