Tagged: block editor
-
AuthorPosts
-
April 10, 2022 at 8:52 pm #1347869
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.
JorgeApril 11, 2022 at 5:58 am #1347895Hey 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,
IsmaelApril 11, 2022 at 6:40 pm #1347992Hi 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
JorgeApril 12, 2022 at 4:21 am #1348022Hi,
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,
IsmaelApril 13, 2022 at 9:56 am #1348198Hi 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
April 13, 2022 at 12:20 pm #1348218Hi,
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 -
AuthorPosts
- The topic ‘How to force programmaticallly Enfold Block Editor to be selected ?’ is closed to new replies.
