-TOO MANY PATTERNS-[18 JULY 2024]

-as of [19 JULY 2024]

.

-LINK-

-18 JULY 2024-

.

-REDDIT POST-

-QUORA QUERY-

.

*QUESTION* —>

As soon as ‘reusable blox’ became available a few years ago, i have been streadily amassing a large collection of what are now “patterns”.

as of today, i have 2,363

in a previous post, i was looking for advice on how to manage occasional lags in loading the patterns to insert into posts.

In the latest wordpress update, the problem has gotten way worse.

despite having lots of bandwidth on my hosting plan, editing patterns can take several minutes to update.

before you were allowed the option of ‘not syncing’ your pattern before publishing it, all the patterns were synced by default.

and there doesn’t seem to be a way to “unsync” them once they are synced.

i have to cut the blocks from the ‘synced pattern’, paste it into a new unsynced pattern, and delete the synced pattern.

i’m hoping there’s a better way than having to repeat this process thousands of times.

and even this method doesn’t really work well for me.

the sheer number of patterns seems to be impeding my ability to do anything with these patterns. even deleting them leaves me with a frozen screen.

editing unsynced patterns is slow, but it eventually works after a minute or so.

i can insert unsynced patterns into posts (though that usually has significant delay).

my workaround is to create chrome bookmarks for the patterns, use a chrome extension to quickly open the unsynced pattern editor, and copy/pasting its content back to my original post.

both synced/unsynced patterns can usually open in a reasonable amount of time.

trying to insert any ‘synced pattern’, no matter how short, into a wordpress post is impossible.

i get the sense that the synced patterns are responsible for the lag, but am at a loss for what to do since even deleting them freezes the editor

since i am using the patterns as ‘post templates’, i have no need for synced patterns.

my workflow consists of creating new posts and then inserting an unsynced template pattern into the first block and filling in the categories.

i’m really hoping that the problem is only being caused by synced patterns, since my workflow has become very dependant on unsynced patterns.

also, i’ve had over 2000 patterns for years now and they never caused any serious problems in my workflow until this latest update in wordpress.

the only slight inconvenience then was that i’d have to manually detach template patterns to insert new parameters for the post.

the usynced pattern does this automatically which really has helped….

hoping that in near future there will be a faster way of ‘unsyncing’ patterns

any advice appreciated 

🙏TIA🙏

.

*ANSWERS* —>

-QUORA-

cay lundén

.

Managing many patterns on a WordPress site, especially with recent changes to the ‘synced pattern’ structure, can be challenging.

Here are some steps and tips to help you manage these patterns and potentially “unsync” them:

As there isn’t a ready-made function, you must add custom code through plugins like Code Snippets or Fluent Snippets.

It is a safe and convenient way to implement the solution without directly changing the theme or core files

.

Steps to Manage and “Unsync” Patterns

Backup Your Site: 

Before making any changes, ensure a complete site backup, including the database and files, so you can restore your site if anything goes wrong

.

Identify Synced Patterns: 

Determine which patterns are causing issues.

You can find these in the WordPress block editor under reusable blocks

.

Export Synced Pattern: 

If possible, export your synced patterns.

This can typically be done through the WordPress dashboard:

– Go to “Tools > Export”

– Select “Reusable Blocks” and export them

.

4.

Create a Script to Unsync Patterns: 

Since WordPress doesn’t provide a built-in way to “unsync” patterns directly, you may need to create a custom script

.

This script can:

– Export the content of each pattern.

– Delete the original synced pattern.

– Re-import the content as individual, non-synced blocks

.

Here’s a basic example of how you might approach this with PHP and WordPress functions:

PHP code:

// Include WordPress functions if running this outside of a plugin/theme require_once('path-to-your-wp-load.php');  function unsync_patterns() {     $args = array(         'post_type' => 'wp_block',         'posts_per_page' => -1     );      $patterns = get_posts($args);      foreach ($patterns as $pattern) {         $content = $pattern->post_content;          // Create a new post with the pattern content         $new_post = array(             'post_title'   => $pattern->post_title,             'post_content' => $content,             'post_status'  => 'publish',             'post_type'    => 'post', // or any other post type where you want to use this content         );          wp_insert_post($new_post);          // Optionally delete the original pattern         // wp_delete_post($pattern->ID, true);     } }  // Run the function unsync_patterns(); 

.

Note: 

This code can be safely added to your site using plugins like Code Snippets or Fluent Snippets.

These plugins allow you to add custom code without directly modifying your theme’s functions.php file

.

Here’s how:

1. Install and Activate Code Snippets or “Fluent Snippets”:

– Go to “Plugins > Add New”

– Search for “Code Snippets” or “Fluent Snippets”

– Install and activate the plugin

.

2.

Add the Custom Code:

– Go to “Snippets > Add New”

– Give your snippet a title (e.g., “Unsync Patterns”)

– Paste the custom code into the code editor

– Choose “Run snippet everywhere”

– Save and activate the snippet

.

Optimization and Testing

1.

Optimize Pattern Management:

– Use a caching plugin to reduce the load on your server.

– Minimize the use of patterns that are not necessary

.

2.

Test Thoroughly: 

Before making these changes on your live site, test them on a staging environment to ensure that everything works as expected without affecting your live site’s functionality

.

3.

Monitor Performance: 

Monitor your site’s performance after making changes.

Use tools like Google PageSpeed Insights or GTmetrix to analyze load times and optimize as needed

.

Alternative Solutions

– Batch Processing: 

If you have many patterns, consider breaking down the process into batches to avoid overwhelming your server

.

– Plugins: 

Look for WordPress plugins that can help manage reusable blocks more efficiently.

Some plugins might offer advanced features for batch editing or exporting/importing patterns.

Examples of such plugins:

Reusable Blocks Extended

Blockmeister

Stackable – Gutenberg Blocks

Genesis Custom Blocks

EditorsKit

.

By following these steps and using a code snippet plugin, you should be able to manage many patterns more effectively and potentially “unsync” them to restore your site’s performance.

I hope this will help you, if so, please upvote!

.

.

*👨‍🔬🕵️‍♀️🙇‍♀️*SKETCHES*🙇‍♂️👩‍🔬🕵️‍♂️*

.

.

👈👈👈☜*-OUR [WORDPRESS SUPPORT THREADS]-* ☞ 👉👉👉

.

.

💕💝💖💓🖤💙🖤💙🖤💙🖤❤️💚💛🧡❣️💞💔💘❣️🧡💛💚❤️🖤💜🖤💙🖤💙🖤💗💖💝💘

.

.

*🌈✨ *TABLE OF CONTENTS* ✨🌷*

.

.

🔥🔥🔥🔥🔥🔥*we won the war* 🔥🔥🔥🔥🔥🔥