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.
[pastacode lang=”php” manual=”add_action(‘acf%2Fsave_post’%2C%20’at_set_pb_content’%2C%2020)%3B%0Afunction%20at_set_pb_content(%20%24post_id%20)%7B%0A%20%20%20%20if(%20isset(%24_POST%5B’acf’%5D)%20%26%26%20get_page_template_slug(%24post_id)%20%3D%3D%20’templates%2Fpage-builder.php’)%20%7B%0A%20%20%20%20%20%20%20%20%24fields%20%3D%20%24_POST%5B’acf’%5D%3B%0A%20%0A%20%20%20%20%20%20%20%20%24new_content%20%3D%20array()%3B%0A%20%0A%20%20%20%20%20%20%20%20if(isset(%24fields%5B’field_554b940e725db’%5D))%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20foreach(%24fields%5B’field_554b940e725db’%5D%20as%20%24k%20%3D%3E%20%24v)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if(%24v%5B’acf_fc_layout’%5D%20%3D%3D%20’page_builder_textarea’)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if(isset(%24v%5B’field_554b945c725df’%5D))%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24new_content%5B%5D%20%3D%20’%3Cdiv%20class%3D%22pb_textarea_1%22%3E’%20.%20%24v%5B’field_554b945c725df’%5D%20.%20’%3C%2Fdiv%3E’%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if(isset(%24v%5B’field_554b94a0725e5’%5D))%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24new_content%5B%5D%20%3D%20’%3Cdiv%20class%3D%22pb_textarea_2%22%3E’%20.%20%24v%5B’field_554b94a0725e5’%5D%20.%20’%3C%2Fdiv%3E’%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if(isset(%24v%5B’field_554b94b6725e6’%5D))%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24new_content%5B%5D%20%3D%20’%3Cdiv%20class%3D%22pb_textarea_3%22%3E’%20.%20%24v%5B’field_554b94b6725e6’%5D%20.%20’%3C%2Fdiv%3E’%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if(isset(%24v%5B’field_554b94c7725e7’%5D))%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24new_content%5B%5D%20%3D%20’%3Cdiv%20class%3D%22pb_textarea_4%22%3E’%20.%20%24v%5B’field_554b94c7725e7’%5D%20.%20’%3C%2Fdiv%3E’%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%0A%20%20%20%20%20%20%20%20%24page%20%3D%20array(%0A%20%20%20%20%20%20%20%20%20%20%20%20’ID’%20%20%20%20%20%20%20%20%20%20%20%3D%3E%20%24post_id%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20’post_content’%20%3D%3E%20implode(‘%20’%2C%20%24new_content)%0A%20%20%20%20%20%20%20%20)%3B%0A%20%0A%20%20%20%20%20%20%20%20remove_action(‘save_post’%2C%20’at_set_pb_content’%2C%2020)%3B%0A%20%20%20%20%20%20%20%20wp_update_post(%20%24page%20)%3B%0A%20%20%20%20%20%20%20%20add_action(‘save_post’%2C%20’at_set_pb_content’%2C%2020)%3B%0A%20%20%20%20%7D%0A%7D” message=”” highlight=”” provider=”manual”/]
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.
War dieser Artikel hilfreich?
Keine Kommentare vorhanden