Skip to main content

When you are using the page builder Yoast is no longer able to analyze the content field, or to be more precise, it appears not to detect any contents as the content field is replaced with a flexible custom field that Yoast is not able to read.
In order to still use the perks of Yoast, we put out a guide on our forums on how to save the contents of a site directly into the (hidden) content field, thus making Yoast work again without any problems. You can find the forum post HERE.

The code can be implemented via mu-plugin or Child Theme. To find a detailed description, please check the developers documentation HERE.

add_action('acf/save_post', 'at_set_pb_content', 20);
function at_set_pb_content( $post_id ){
    if( isset($_POST['acf']) && get_page_template_slug($post_id) == 'templates/page-builder.php') {
        $fields = $_POST['acf'];
        $new_content = array();
        if(isset($fields['field_554b940e725db'])) {
            foreach($fields['field_554b940e725db'] as $k => $v) {
                if($v['acf_fc_layout'] == 'page_builder_textarea') {
                    if(isset($v['field_554b945c725df'])) {
                        $new_content[] = '<div class="pb_textarea_1">' . $v['field_554b945c725df'] . '</div>';
                    if(isset($v['field_554b94a0725e5'])) {
                        $new_content[] = '<div class="pb_textarea_2">' . $v['field_554b94a0725e5'] . '</div>';
                    if(isset($v['field_554b94b6725e6'])) {
                        $new_content[] = '<div class="pb_textarea_3">' . $v['field_554b94b6725e6'] . '</div>';
                    if(isset($v['field_554b94c7725e7'])) {
                        $new_content[] = '<div class="pb_textarea_4">' . $v['field_554b94c7725e7'] . '</div>';
        $page = array(
            'ID'           => $post_id,
            'post_content' => implode(' ', $new_content)
        remove_action('save_post', 'at_set_pb_content', 20);
        wp_update_post( $page );
        add_action('save_post', 'at_set_pb_content', 20);

Small hint: The traffic light system of Yoast is a good guideline to optimize your content, it is however a necessity to have all green lights. Google and other search engines turn out to be more complex than just the 10 aspects that Yoast is considering.

Furthermore a search engine is evaluating your entire site (including headers, navigation, sidebar etc.) and not only the content field like Yoast does.

Was this article helpful?

1 Star2 Stars3 Stars4 Stars5 Stars
4.00 / 5

Keine Kommentare vorhanden

You have a question or an opinion about this post? Share it with us!

Your email address will not be published. Required fields are marked *