Skip to content

Instantly share code, notes, and snippets.

@runezero
Created October 10, 2022 18:26
Show Gist options
  • Save runezero/c4c9800d7687869c44c89b6dfe77f9d8 to your computer and use it in GitHub Desktop.
Save runezero/c4c9800d7687869c44c89b6dfe77f9d8 to your computer and use it in GitHub Desktop.
[Enfold Exerpt correction ALB] fix the content exerpt from ALB built pages #enfold
add_filter('content_save_pre', 'dsm_content_save_pre_enfold_alb', 100, 1);
function dsm_content_save_pre_enfold_alb($content)
{
if (is_admin()) {
$post_id = get_the_ID();
$post_type = get_post_type($post_id);
if ($post_type == 'post') {
$builder_stat = Avia_Builder()->get_alb_builder_status($post_id);
if (('active' == $builder_stat) && !is_preview()) {
if (strpos($content, "[") !== false) {
$content = str_replace(['[', ']', "'"], ['<', '>', '"'], $content);
$content = strip_tags($content);
}
}
}
}
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment