Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Importing Global Styles doesn’t automatically apply them

  • Hi,

    I’m using a WP-CLI based system to create new websites and to create GP Elements and GB Global Styles, I simply import XMLS files generated with the default WordPress export tool. I import them using the wordpress-importer tool and it works !

    But, after importing, global styles don’t seem to be registered yet, I cannot select them even though if I go inside a global style view they are all there. I need to update the global styles pages individually in order for them to be recognized and used in my layouts.

    After saving, if I have pages or elements already using these styles, they are then selected automatically. But I need to force update these Global Styles manually in order for it to work.

    Is there something I can do to register those styles after exporting them through one of WP-CLI command ? (option update, writing in the DB, etc.)

    Thanks !

  • Hi there,

    We run GenerateBlocks_Pro_Global_Styles::build_css() using the save_post_gblocks_global_style hook.

    Not sure if it’s possible to loop through each post and trigger a save using WP-CLI?

    We’re going to look at improving this system so that this step isn’t necessary.

  • Hey Tom,

    Thanks for the quick and detailed answer. Maybe an export / import Global Styles, Elements, Pattern, etc. functionality would be a good workaround. I know support for WP-CLI command has already been requested in a few places, but that would be great too.

    I’ll see if I can find a way to do this. I found this little WP-CLI command that triggers post saving, I could adapt it for global styles.

    But I would first have to be able to add this new WP-CLI command to every new site I create. Not sure if it’s easier.

    In the meantime, I’ll do this manually, I don’t believe removing this hook is a primary feature request 🙂

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.