Tagged: block editor
Hi,
Block Editor is selected instead of WP Classic Editor in themes options.
I want to duplicate programmatically an existing page with Advanced Layout Editor selected. Therefore, when I edit the duplicated page Classic Editor is selected.
How to force programmaticallly Enfold Block Editor to be selected ?
Kind regards.
Jorge
Hey Jorge,
Thank you for the inquiry.
The custom field _aviaLayoutBuilder_active has to be attached to the post in order to enable the Advance Layout Builder. You can set that manually after saving the post using the wp_insert_post hook.
// https://developer.wordpress.org/reference/functions/wp_insert_post/
Best regards,
Ismael
Hi Ismael,
Thank you for your answer.
I added custom field _aviaLayoutBuilder_active when using the wp_insert_post as followed :
$post_id = 1873;
$post = (array) get_post( $post_id );
$post[‘_aviaLayoutBuilder_active’] = true;
$post_id = wp_insert_post( $post );
Unfortunately, it did not work.
Regards
Jorge
Hi,
Did you save the info as a custom field of the page or post? You have to use the update_post_meta or the add_post_meta function in order to save the info as custom field.
// https://developer.wordpress.org/reference/functions/update_post_meta/
// https://developer.wordpress.org/reference/functions/add_post_meta/
Best regards,
Ismael
Hi Ismael,
Thank you for the answer.
Advance Layout Builder is enabled now by setting manually custom field _aviaLayoutBuilder_active. But, content is still not displaying.
After investigating, I notice that custom field _aviaLayoutBuilderCleanData has to be set as well with the field post_content.
It looks good now !
Many thanks for your help.
Please close this ticket.
Best regards
Ismael
Hi,
Great, I’m glad that you got it working, and thanks for the update. I’ll close this thread for now then, please open a new thread if you should have any further questions or problems.
Best regards,
Rikard