Elementor rendered content
-
Hi,
i’m using Elementor to edit my content on my website. But in some specific pages I load custom model to display recurring datas.
I need the content displayed in these pages indexed as well (in fact i need to index content as it’s displayed on front).I tried to replace the content indexed with the content displayed by Elementor.add_filter('relevanssi_content_to_index', 'clean_elementor_content_for_relevanssi', 10, 2);
function clean_elementor_content_for_relevanssi($content, $post)
{
// Check if Elementor is active and the post is built with Elementor
if (did_action('elementor/loaded') && \Elementor\Plugin::$instance->documents->get($post->ID)->is_built_with_elementor()) {
// Get the fully rendered Elementor content
**BUG if I return dummy data there it's working (even when i return the $cleaned_content text when I log it **
$elementor_content = \Elementor\Plugin::$instance->frontend->get_builder_content($post->ID, true);
**BUG if i return dummy data there it's NOT (nothing indexed for the post when using debugging tool) working **
// Clean the content by extracting only the visible text
$cleaned_content = extract_visible_text($elementor_content);
// Return the cleaned content for Relevanssi to index
return $cleaned_content;
}
// If not built with Elementor, return the original content
return $content;
}Do you have an idea what’s going on ?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.