Title: Export blocks with php code not working
Last modified: September 1, 2020

---

# Export blocks with php code not working

 *  Resolved [jospii](https://wordpress.org/support/users/jospii/)
 * (@jospii)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/export-blocks-with-php-code-not-working/)
 * I have created my own custom blocks and tried to export them to another theme
   with the php code and I have added it to functions.php. The code runs, but no
   actual importing happens.
 * edit: I love your plugin btw.
 * edit2: This is the actual code i added to functions.php:
    if ( function_exists(‘
   lazyblocks’ ) ) :
 *  lazyblocks()->add_block( array(
    ‘id’ => 341, ‘title’ => ‘Location’, ‘icon’ 
   => ‘<svg xmlns=”[http://www.w3.org/2000/svg&#8221](http://www.w3.org/2000/svg&#8221);
   width=”24″ height=”24″ viewBox=”0 0 24 24″><path d=”M12 8c-2.21 0-4 1.79-4 4s1.79
   4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83
   3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.
   46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13
   7 7-3.13 7-7 7z” /></svg>’, ‘keywords’ => array( ), ‘slug’ => ‘lazyblock/location’,‘
   description’ => ‘Where to find us’, ‘category’ => ‘lazyblocks’, ‘category_label’
   => ‘lazyblocks’, ‘supports’ => array( ‘customClassName’ => true, ‘anchor’ => 
   false, ‘align’ => array( 0 => ‘wide’, 1 => ‘full’, ), ‘html’ => false, ‘multiple’
   => true, ‘inserter’ => true, ), ‘ghostkit’ => array( ‘supports’ => array( ‘spacings’
   => false, ‘display’ => false, ‘scrollReveal’ => false, ‘frame’ => false, ‘customCSS’
   => false, ), ), ‘controls’ => array( ‘control_d8b8e247ce’ => array( ‘type’ =>‘
   text’, ‘name’ => ‘otsikko’, ‘default’ => ”, ‘label’ => ‘Otsikko’, ‘help’ => ”,‘
   child_of’ => ”, ‘placement’ => ‘content’, ‘width’ => ‘100’, ‘hide_if_not_selected’
   => ‘true’, ‘save_in_meta’ => ‘false’, ‘save_in_meta_name’ => ”, ‘required’ =>‘
   false’, ‘placeholder’ => ”, ‘characters_limit’ => ”, ), ‘control_2feb434f48’ 
   => array( ‘type’ => ‘textarea’, ‘name’ => ‘osoiterivi_1’, ‘default’ => ”, ‘label’
   => ‘Osoiterivi 1’, ‘help’ => ”, ‘child_of’ => ”, ‘placement’ => ‘content’, ‘width’
   => ‘100’, ‘hide_if_not_selected’ => ‘true’, ‘save_in_meta’ => ‘false’, ‘save_in_meta_name’
   => ”, ‘required’ => ‘false’, ‘placeholder’ => ”, ‘characters_limit’ => ”, ), ‘
   control_948bc1401e’ => array( ‘type’ => ‘textarea’, ‘name’ => ‘osoiterivi_2’,‘
   default’ => ”, ‘label’ => ‘Osoiterivi 2’, ‘help’ => ”, ‘child_of’ => ”, ‘placement’
   => ‘content’, ‘width’ => ‘100’, ‘hide_if_not_selected’ => ‘true’, ‘save_in_meta’
   => ‘false’, ‘save_in_meta_name’ => ”, ‘required’ => ‘false’, ‘placeholder’ =>”,‘
   characters_limit’ => ”, ), ‘control_c218f54faa’ => array( ‘type’ => ‘image’, ‘
   name’ => ‘kartta_1’, ‘default’ => ”, ‘label’ => ‘Kartta 1’, ‘help’ => ”, ‘child_of’
   => ”, ‘placement’ => ‘content’, ‘width’ => ‘100’, ‘hide_if_not_selected’ => ‘
   true’, ‘save_in_meta’ => ‘false’, ‘save_in_meta_name’ => ”, ‘required’ => ‘false’,‘
   placeholder’ => ”, ‘characters_limit’ => ”, ), ‘control_331a8240be’ => array(‘
   type’ => ‘image’, ‘name’ => ‘kartta_2’, ‘default’ => ”, ‘label’ => ‘Kartta 2’,‘
   help’ => ”, ‘child_of’ => ”, ‘placement’ => ‘content’, ‘width’ => ‘100’, ‘hide_if_not_selected’
   => ‘true’, ‘save_in_meta’ => ‘false’, ‘save_in_meta_name’ => ”, ‘required’ =>‘
   false’, ‘placeholder’ => ”, ‘characters_limit’ => ”, ), ), ‘code’ => array( ‘
   output_method’ => ‘template’, ‘editor_html’ => ”, ‘editor_callback’ => ”, ‘editor_css’
   => ”, ‘frontend_html’ => ”, ‘frontend_callback’ => ”, ‘frontend_css’ => ”, ‘show_preview’
   => ‘always’, ‘single_output’ => false, ), ‘condition’ => array( ), ) );
 * endif;
    -  This topic was modified 5 years, 8 months ago by [jospii](https://wordpress.org/support/users/jospii/).
    -  This topic was modified 5 years, 8 months ago by [jospii](https://wordpress.org/support/users/jospii/).
    -  This topic was modified 5 years, 8 months ago by [jospii](https://wordpress.org/support/users/jospii/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [jospii](https://wordpress.org/support/users/jospii/)
 * (@jospii)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/export-blocks-with-php-code-not-working/#post-13344196)
 * I also noticed that I have the same problem with ACF plugin, so maybe the problem
   isn’t a plugin specific.
 *  Thread Starter [jospii](https://wordpress.org/support/users/jospii/)
 * (@jospii)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/export-blocks-with-php-code-not-working/#post-13344333)
 * Cleaning old entries from database resolved this. I also was confused because
   the blocks weren’t listed at ‘post_type=lazyblocks’ like they normally would 
   be but it still works.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Export blocks with php code not working’ is closed to new replies.

 * ![](https://ps.w.org/lazy-blocks/assets/icon-256x256.png?rev=2584676)
 * [Custom Block Builder - Lazy Blocks](https://wordpress.org/plugins/lazy-blocks/)
 * [Support Threads](https://wordpress.org/support/plugin/lazy-blocks/)
 * [Active Topics](https://wordpress.org/support/plugin/lazy-blocks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/lazy-blocks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/lazy-blocks/reviews/)

 * 2 replies
 * 1 participant
 * Last reply from: [jospii](https://wordpress.org/support/users/jospii/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/export-blocks-with-php-code-not-working/#post-13344333)
 * Status: resolved