Skip to main content
Print

AISEO FIX for divi 5


// Temporary fix for an AIOSEO Pro + Divi 5 interaction that causes some
// Divi columns to render with the wrong border / padding / alignment on
// the front end. Safe to remove once AIOSEO Pro ships an updated build.

add_action( 'init', static function () {
if ( ! function_exists( 'aioseo' ) ) {
return;
}

$standalone = aioseo()->standalone ?? null;
if ( ! $standalone || empty( $standalone->pageBuilderIntegrations['divi'] ) ) {
return;
}

if ( $standalone->pageBuilderIntegrations['divi'] instanceof AIOSEO_Divi_Column_Index_Fix ) {
return;
}

if ( ! class_exists( 'AIOSEO_Divi_Column_Index_Fix', false ) ) {
class AIOSEO_Divi_Column_Index_Fix extends \AIOSEO\Plugin\Common\Standalone\PageBuilders\Divi {
public function processContent( $postId, $content = null ) {
if ( empty( $content ) ) {
$post = get_post( $postId );
if ( $post instanceof \WP_Post ) {
$content = $post->post_content;
}
}

if ( aioseo()->helpers->isAjaxCronRestRequest() && ! doing_filter( 'the_content' ) ) {
return apply_filters( 'the_content', $content );
}

return $content;
}
}
}

$standalone->pageBuilderIntegrations['divi'] = new AIOSEO_Divi_Column_Index_Fix();
}, PHP_INT_MAX );

Table of Contents