Site logo

Archived topic

copy/paste GB blocks

3 replies · Started by Stefanie on January 23, 2023

Viewing posts 1–4 of 4

Hi there,

somewhere in this forum (unfortunately i can't find the thread again) i read that you are not supposed to copy/paste the GB blocks. I think it has something to do with an ID that each block gets assigned automatically.

What i do very often: i go to the 3 dot menu in the editor and choose "copy all blocks". Then i create a new page and copy the content from the clipboard into it. I do this to save me a plugin (duplicate-page or similar).

Before i worked with GB, i always found this extremely handy! Now i'm worried that i can't do this procedure with GB blocks anymore. Is that the case? Is there an alternative to copy pages quickly?

Thank you!
Stefanie

Hi there,

if you copy and paste to a new page, then GB won't refresh the classIDs. So both pages will have blocks with duplicate classIDs.

However this in itself doesn't cause an issue.
An issue arises if a page on the front end has duplicate blocks that were given different styles.
This can happen if I:

1. edited a Page and Copied a GB Block
2. created a Block Element eg. a Page Hero or a Footer and pasted my copied block into the element.
2.1 Made a style change to that block.
2.2 set the Block Element to display on the page i copied the block from.

What happens then, is both blocks get loaded with the same classID and whichever blocks CSS got loaded later would affect both.

In this example i would make a duplicate block.

So as long as a copied block isn't being shown on the same page as its original eg. via an Element or a Widget area then there should be no issues.

If you find yourself reusing a lot of block content you created, then you may be interested in GenerateBlocks Pro which has a Local Pattern Library for you to save them to. And those can be added anywhere without any issues.

Thank you David, now i know where the pitfalls are!
If I understand you correctly, the ID is not identical when duplicating blocks, only when copying, right?

Thats correct, if you Duplicate a block it will always regenerated the ID.

This archived topic is closed to new replies.