Include Divi Areas in search results?
Popup contents are intentionally excluded from front-end search results for some reasons:
- Generally, Divi Areas are no stand-alone pages, but small bits that are added to any other page
- Popups do not have a public URL that visitors can open to see them
- Most Popups contain little information that's not helpful for search
- Sometimes a Popup could reveal information that a guest user should not see (like coupon codes or sales announcements)
Though, if you have a site that uses Divi Areas to provide additional content for your visitors, you can also include Divi Areas in your WordPress search results.
The solution takes surprisingly little code and can be implemented with only two WP filters:
// Filter 1: Include Divi Areas in search results. add_filter( 'divimode_register_post_type_divi-area', 'my_custom_divi_area_args' ); // Filter 2: Allow all users to see the Divi Area preview page. add_filter( 'divi_areas_can_preview_area', 'my_custom_divi_area_permissions', 10, 2 );
A full sample with more explanation is available in our Gist here: