• Resolved rvnd

    (@rvnd)


    Hi

    I’d like to create an edit link on all Lazyblocks.

    I am trying to do it this way and was hoping you could tell me how to replace “XXX” with the Post ID of the Lazy Block.

    function my_lzb_block_render_callback( $result, $attributes, $context ) {
        return '<a href="/wp-admin/post.php?post=XXX&action=edit" target="_blank">Edit LazyBlock</a>';
    }
    add_filter( 'lzb/block_render/callback', 'my_lzb_block_render_callback', 10, 3 );
Viewing 1 replies (of 1 total)
  • Plugin Author nK

    (@nko)

    Hey.

    Something like this one should work:

    <?php
    
    $block_data = lazyblocks()->blocks()->get_block( $attributes['lazyblock']['slug'] );
    
    if ( isset( $block_data['id'] ) ) {
      echo 'ID: ' . esc_html( $block_data['id'] );
    }
    

    Regards, nK.

Viewing 1 replies (of 1 total)

The topic ‘edit Link’ is closed to new replies.