Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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.
    Jorge

    #1347895

    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

    #1347992

    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

    #1348022

    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

    #1348198

    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

    #1348218

    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

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘How to force programmaticallly Enfold Block Editor to be selected ?’ is closed to new replies.