Created
October 10, 2022 18:26
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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