Atlantic Business Technologies, Inc.

Category: WordPress

  • Optimizing The Events Calendar Plugin in WordPress: Resolving High CPU Usage During Query Execution

    Optimizing The Events Calendar Plugin in WordPress: Resolving High CPU Usage During Query Execution

    Recently, we encountered an issue while upgrading a client’s WordPress site that utilizes The Events Calendar plugin from theeventscalendar.com. The upgrade caused a significant spike in database CPU usage, leading to severe performance degradation and eventual downtime. The site would become unresponsive within 1 to 12 hours post-deployment, forcing us to revert to the previous version.

    Identifying the Issue: A Slow Query

    After investigation, we isolated the problem to a specific SQL query that was being executed repeatedly:

    SELECT SQL_CALC_FOUND_ROWS wp_4_posts.ID, CAST(wp_4_tec_occurrences.start_date_utc AS DATETIME) AS event_date_utc
    FROM wp_4_posts
    LEFT JOIN wp_4_term_relationships ON (wp_4_posts.ID = wp_4_term_relationships.object_id)
    LEFT JOIN wp_4_term_relationships AS tt1 ON (wp_4_posts.ID = tt1.object_id)
    LEFT JOIN wp_4_term_relationships AS tt2 ON (wp_4_posts.ID = tt2.object_id)
    LEFT JOIN wp_4_term_relationships AS tt3 ON (wp_4_posts.ID = tt3.object_id)
    LEFT JOIN wp_4_term_relationships AS tt4 ON (wp_4_posts.ID = tt4.object_id)
    LEFT JOIN wp_4_term_relationships AS tt5 ON (wp_4_posts.ID = tt5.object_id)
    LEFT JOIN wp_4_term_relationships AS tt6 ON (wp_4_posts.ID = tt6.object_id)
    JOIN wp_4_tec_occurrences ON wp_4_posts.ID = wp_4_tec_occurrences.post_id
    WHERE 1=1
    AND (
    (
    wp_4_term_relationships.term_taxonomy_id IN (147,148,149,150,96)
    AND tt1.term_taxonomy_id IN (147,148,149,150,96)
    AND tt2.term_taxonomy_id IN (147,148,149,150,96)
    AND tt3.term_taxonomy_id IN (147,148,149,150,96)
    AND tt4.term_taxonomy_id IN (147,148,149,150,96)
    AND tt5.term_taxonomy_id IN (147,148,149,150,96)
    AND tt6.term_taxonomy_id IN (147,148,149,150,96)
    )
    )
    AND CAST(wp_4_tec_occurrences.start_date_utc AS DATETIME) > '2024-06-24 03:59:59'
    AND wp_4_posts.post_type = 'tribe_events'
    AND wp_4_posts.post_status = 'publish'
    GROUP BY wp_4_tec_occurrences.occurrence_id
    ORDER BY wp_4_tec_occurrences.start_date_utc ASC, wp_4_posts.post_date ASC
    LIMIT 0, 1;

    Each execution of this query was taking over 23 seconds, leading to a bottleneck that caused the CPU to max out at 100%. Clearly, this query needed optimization.

    Investigating the Query: EXPLAIN Command to the Rescue

    To better understand what was causing the delay, we turned to MySQL’s EXPLAIN command. By analyzing the query execution plan, we could pinpoint inefficiencies related to the joins and groupings, particularly involving the wp_4_term_relationships and wp_4_tec_occurrences tables.

    We found that key indexes were either missing or not being utilized optimally. The absence of appropriate indexing on columns like object_id, term_taxonomy_id, and post_id meant that the database had to scan entire tables repeatedly—leading to high CPU usage and slow response times.

    The Fix: Adding Indexes

    To resolve the issue, we added three specific indexes. These were designed to speed up the joins and comparisons that were bogging down the query:

    CREATE INDEX idx_wp_4_posts_id ON wp_4_posts (ID);
    CREATE INDEX idx_wp_4_term_relationships ON wp_4_term_relationships (object_id, term_taxonomy_id);
    CREATE INDEX idx_wp_4_tec_occurrences ON wp_4_tec_occurrences (post_id, start_date_utc);

    By introducing these indexes, we were able to reduce the query execution time from 23 seconds down to just 1.3 seconds—a significant performance boost.

    Monitoring the Results

    To ensure everything was working smoothly in production, we continuously monitored our query performance using the following command:

    SHOW FULL PROCESSLIST;

    This allowed us to track the running queries and verify that our optimization was successful. The CPU usage stabilized, and the site performance returned to normal without further issues.

    Conclusion: Indexing Matters

    If you’re running into similar performance issues after upgrading The Events Calendar plugin or any other database-intensive WordPress plugin, we recommend analyzing your queries using EXPLAIN and considering appropriate indexing. Note that your table names might differ depending on your WordPress setup, so adjust accordingly.

    Optimizing database performance can be tricky, but with the right tools and approach, even complex queries can be tuned for efficiency.

  • The 5 Best WordPress Plugins for Large Content Websites

    The 5 Best WordPress Plugins for Large Content Websites

    Even though one of ABT’s core offerings is custom development, I have always advocated for not reinventing the wheel if necessary. So I’ve come across a number of plugins that I have since found indispensable in managing a large WordPress site – and our site isn’t even nearly as large as others! Here are the five top WordPress plugins I recommend for pretty much anybody. These may still be useful if you’ve got a 5-10 page site – but if you’ve got hundreds or thousands of pages and posts, I think these are badass!

    Why did I write this? I’ve been the primary person responsible for the Atlantic BT website for more than a year now. By that, I don’t mean I do the development or write every single piece of content, but I am the main admin of the website. Similar to the role many of our clients are in, or you may be. I thought an article that isn’t based on popularity or what sells, but instead first hand practical use, would be helpful to you.

    ABT does not get any referral fees or compensation, this is all just personal opinion by the author.

    Yoast SEO Premium

    Yoast is one of those plugins that it seems like everyone uses. Like, everyone. And for good reason – when it comes to managing SEO it’s got a great set of features and admin user experience too. I tried the premium version out for some of the features, and it’s here to stay. I won’t go into the free version features, just some of the premium ones that make it worth it.

    Redirect Management

    The feature I love the best is the redirect management. I try to stay up to date on making sure we don’t have any internal 404 links, and this helps a ton. You can manually add any redirects that you want – so if you’re doing spring-cleaning on your content, it’s really easy to make sure no one hits a dead end. But even better is the real-time redirect updates. If you change the URL of a page, and you hit update, Yoast will automatically create that redirect for you. Also, if you trash an old page that’s not relevant anymore, Yoast will ask if you want to redirect or create a 410 status code for that URL. (A 410 status code is how Google and the rest of the internet knows the page used to exist and was purposed removed).

    Search Engine Previews

    When you’re editing a page or post, Yoast gives you a preview of how a search result will look based on the title, excerpt, etc. With premium, you can also see previews of social shares for Facebook and Twitter, and even override the info each if you want to tweak it. It’s not a necessity to do so on every page, but if you’re heavy into social media, it’s a great option.

    I haven’t really dug into the Yoast AI implementation, since we tend to use ChatGPT more regularly. And while there is a feature in premium where Yoast offers suggestions to link to other pages on your site, the next plugin is much better for that.

    LinkWhisper

    I was looking for an AI driven tool to recommend links to other pages on our site, beyond what Yoast was doing. I came across LinkWhisper and got that and a lot more.

    Internal Linking

    You’re able to generate more internal linking in a few ways. You can edit a page or post, and LinkWhisper will look at the content on the page and recommend links to other pages. From the “All Posts” or “All Pages” list you can also get a list of suggestions to link to that page. There are also some nice reports to give you insight to how much linking you’re doing all around.

    Auto Linking

    I think “auto linking” is the coolest feature. As an example, I could add “best WordPress plugins” to auto-link to this post. If that exact phrase appears in any existing content, or any new content, the link to this post will automatically happen!

    Error Report and URL Changer

    The last features which has helped a ton in regularly cleaning up SEO is the error report and the URL changer. The error report is a great way to find and fix broken links (both internal and external). The URL changer compliments Yoast Premium’s redirect feature wonderfully. Yoast will make sure that any existing links to old content don’t break. But it’s still best practice to not go through redirects and change the content to link to the new URLs. This is where LinkWhisper comes in. You add the old and new URLs, and instantly all your content is updated.

    GTM4WP – A Google Tag Manager (GTM) plugin for WordPress

    If you use Google Tag Manager, I think this plugin is a must. By putting in your GTM code, the plugin will add the necessary script on your site and has a lot of adjustments. There are a ton of settings which can get pretty technical that I won’t go into, but there are two main aspects that make this completely worth it.

    In “Basic Data / Posts”, you can very quickly add information that go to GTM (which you’d probably want to push through to Google Analytics). Info like post author, title, categories, post type; if you’re big into analytics, and you want to break down the analytics in a number of ways, this makes it easy.

    In “Basic Data / Visitors” is the ability to include data such as “is the user logged into the admin” and user roles. This becomes extremely valuable when you exclude, or make separate GA audiences for, logged in content editors and admin. Atlantic BT employees end up browsing the site a ton, including myself. I don’t want that traffic in our Google Analytics, though. With this feature, we can prevent our analytics from being inflated by our ourselves!

    Find My Blocks!

    This one is a little more technical, and more useful on sites like the ones Atlantic BT creates, where we build custom blocks. We recently did an audit to find out which custom blocks weren’t being used or catalog where they were. This is a free, light plugin which made that audit easy.

    Whether you’re doing an audit, or you know you used a block (somewhere!) and can’t remember where – this plugin is a winner. 

    WP All Import & WP All Export

    If you’ve got hundreds or thousands of posts and pages, and you like working in spreadsheets, this plugin pair is indispensable. Trying to export information from WordPress using the default tools is… underwhelming. These plugins allow creating CSV (and other) files customized to the fields you care about. You can save templates and really control what gets imported so you don’t incorrectly overwrite things.

    If you’re in marketing and deal with SEO, exporting everything is wonderful so you can wholistically view your metadata and targeted keywords. Then you can work through your strategy in Excel or Google Sheets. If you’re going through a content audit or need to make bulk content fixes, the content field is something which is available for exports and imports too.

  • WordPress WebP Conversion

    WordPress WebP Conversion

    Looking to resolve the “Serve images in next-gen formats” warning in PageSpeed Insights? This is a step-by-step guide for a WordPress website. This is for sites that are using S3 to host all media. The implementation that inspired this post used WP Offload Media, but the steps involving that tool are likely simple enough that they’ll carry over to other offloading plugins, so I’ve abstracted that part of the instructions to be plugin-agnostic.

    Instructions

    1. Add the EWWW Image Optimizer plugin to your project (WP Packagist has it at the time of writing).
    2. Activate EWWW and go to its settings page
    3. Turn on Ludicrous Mode so you can see all settings
    4. Ensure both WebP Conversion and Force WebP are turned on (Force WebP is regrettable, but it’s necessary if you don’t have local copies of your images, as specified in the linked article).
    5. Save your settings changes.
    6. If you have pre-existing media, you’ll want to run a Bulk Optimize as outlined below to make sure all your images have a WebP version available.
      1. Use your media offloading plugin to copy all media from the bucket to the server if they aren’t there already.
      2. Run EWWW’s Bulk Optimize tool (Media > Bulk Optimize) with the WebP Only and Force re-optimize options checked. Theoretically, it should work without these checked, but both seem to skip over some items unnecessarily when unchecked, leading to an incomplete bulk optimization. If you want to compress as well, it may be best to do that in a separate optimization step.
      3. After all media has been converted, copy everything back to the bucket from the server.
    7. Now you need to choose a WebP delivery method. Go back to the EWWW settings and scroll to the bottom of the Basic tab where it says “WebP Delivery Method”. Picture WebP Rewriting was chosen for my implementation since it uses native browser functionality designed for exactly this purpose and requires no JS injection. If you have extra URL patterns that you want to be rewritten, add them to the WebP URLs section as described in this article, which is the same as the one linked for the Force WebP option above.

    Hopefully, if you followed these instructions, you should now be serving WebP images to customers whose browsers support the format, all from your S3 bucket. You can delete the images from the server now if you want them only stored on the bucket.

  • Is WordPress the best option for my CMS?

    Is WordPress the best option for my CMS?

    WordPress is the most popular Content Management System (CMS), covering 64% of the market. That’s because it’s a free, open-source platform that is simple to host and manage.

    At Atlantic BT, we find that WordPress is a good option in many industries in a range of business cases. Take a look at some of the advantages of using WordPress and see if it fits your unique business needs.

    WordPress’ popularity provides many benefits.

    Due to its popularity, WordPress has a mature ecosystem of plugins, themes, and tools that are easy to integrate. Furthermore, there is a large community of developers, documentation, and content creators for support. Many third-party plugins have created integrations for certain business cases which simplify data streams.

    WordPress facilitates DevOps.

    The WordPress core codebase and most publicly available plugins are available through wpackagist, so you can track and manage dependencies via Composer.

    Using dependency management tools like Composer allows development teams to easily track, update, test, and deploy updates to dependencies based on known compatibility.

    It also makes it easier to identify any conflicts between versions of dependencies and to roll-back those dependencies to previous versions known to work.

    WordPress makes it easier for marketers to do their jobs.

    Marketers love to use WordPress for two primary reasons:

    • WordPress is designed for SEO. Advanced features are freely available through the ubiquitous Yoast SEO plugin.
    • WordPress is simple to administer, with an intuitive UI and a range of plugins and themes that provide similarly intuitive UIs.

    WordPress simplifies the web design process.

    WordPress includes a basic site layout and navigation out of the box. Furthermore, custom themes can easily be created by web designers and applied through PHP development.

    In what scenarios would WordPress be a good option?

    In general, WordPress can be a good fit for simpler websites. Simple does not refer to size; WordPress can be used for small businesses or large organizations. But the functionalities your business requires are key deciding factors. WordPress may be a good fit if:

    You are building a “brochure website”.

    Maybe you are creating a blog or “brochure site” that will not require custom functionalities. In this case, you can take advantage of WordPress’ out-of-the-box features like:

    • Blogging Platform
      • Commenting on content.
      • Tracking multiple authors, editors, publishers by user permissions.
      • Scheduled publishing content in advance.
    • Easily administered content types whose schema may change slightly over time.
    • Hierarchical Taxonomy
    • Basic search functionality based on dates of content entry, taxonomy, and content itself.

    You have a small scope or budget.

    Speaking of using out-of-the-box features, relying on these will keep you within a tight budget. If WordPress’ core features will serve your needs, it’s an extremely affordable option.

    Additionally, many smaller WordPress sites have a simple infrastructure that allows it to work with cheaper hosting solutions.

    Third-party extensions can also be much cheaper than with other frameworks and SaaS offerings.

    You plan to take over all administration/configuration of the site, without relying on a partner.

    Because of WordPress’ administrative simplicity, it is a good option if a less technical role needs to take on site maintenance.

    You are creating a proof of concept.

    If you simply need to create a Proof-of-concept or MVP, you can likely accept some trade-offs with customization. Tradeoffs could include using a less refined admin experience or less efficient backend in exchange for rapid prototyping and development.

    You are building a small eCommerce store.

    Small businesses can use WordPress for eCommerce if:

    • They can rely on simple payment processors (like Stripe)
    • They have small inventories to manage
    • There is no need to integrate with a large CRM or other software

    For example, perhaps your website is primarily used to showcase services, offering just a few products for sale in addition. If eCommerce is not the primary focus of a website, WordPress could be the optimal solution.

    You need to unify multiple sites.

    If you need to create a network of sites sharing similar functionality and a common administration area, a WordPress Multisite can help you achieve your goals.

    In what scenarios would WordPress not be a good option?

    If any of the following cases apply, you might consider looking at using a different CMS solution (like Drupal) or a custom framework (like Laravel) to build your application.

    You have many custom requirements.

    Required functionality may not be easily be added. Maybe your website requirements do not not closely fit what can be accomplished using the core WordPress codebase.

    You want to have extra data control.

    Maybe you want to have fine control over how your data is stored, modified, and queried. In this case, WordPress’ database structure is limited and not scalable for extensive queries.

    Furthermore, this limiting factor can make custom reporting on your data difficult to implement.

    You need to define content types with complex and nested relationships.

    Let’s say a site needs to track a complex hierarchy of custom content types (industry → company → person) where some of those content types may also need to relate to themselves (person → person).

    This may work well with small queries on each page for navigation. But let’s say you want to query through all data and generate a report for all people in the system, showing how companies, industries, and other people are related.

    In this type of query, the WordPress database schema will make that very slow and inefficient. It would be better to implement a custom framework (like Laravel) where you can easily define data relationships.

    Security is a high priority for your platform.

    Due to its open-source nature and large market share, WordPress is often a target for malicious actors. Security updates need to be applied regularly to stay ahead of those who would try to force entry.

    WordPress does not provide much control over format of data in the database. Unless you are prepared to store and manipulate data yourself using basic PHP functionality, you should not use WordPress to store sensitive customer data or other personally identifiable information.

    A team experienced in many platforms can guide you.

    Need help evaluating your situation and choosing the best platform? Reach out for a free consultation with one of our experts. We’re happy to help you get started with your solution.

  • How Gutenberg is changing the game for WordPress users.

    How Gutenberg is changing the game for WordPress users.

    Gutenberg is gaining popularity every month, and it has rapidly become the standard for building custom WordPress websites. Take a look at how past solutions have evolved, how you can benefit from Gutenberg, and how to set yourself up for success.

    How Atlantic BT used to address WordPress customization issues.

    TinyMCE was the default WordPress editor in the past. Due to its limitations with responsiveness and design flexibility, Atlantic BT built a “flexible bands” system with Advanced Custom Fields (ACF) to provide custom options.

    This system was built upon reusable design components. It created a much-needed balance between brand adherence and flexibility. Teams were able to build pages on their own using pre-styled components.

    Flexible bands worked well for our clients who were committed to learning the custom system (for example, Campbell University). Many felt that they were no longer confined by their WordPress editor and could rapidly produce new pages. Additionally, a system based on reusable components simplified development and design.

    “Flexible bands” are no longer necessary – Gutenberg is changing the game.

    While Atlantic BT’s flexible band system initially filled the gaps, WordPress caught up to modern design needs. Their latest editing experience, Gutenberg, now offers a similar solution with additional benefits.

    Gutenberg also works best with reusable components. The components, called “content blocks,” can be used to build pages in the same way as the flexible band system Atlantic BT developed.

    WordPress has worked out many of the kinks since its December 2018 release, which continues to boost Gutenberg’s popularity. Better still, Gutenberg is so widely used that it’s easy to find tutorials, support, and training.

    Why do you need to switch now?

    Upgrading to Gutenberg can do more than enhance your editing experience. In order to stay ahead of your competition, it’s important to implement modern technologies. Yoast said it best:

    “The Gutenberg project and with it, the Block Editor, is literally where all the innovation in the WordPress space is happening. Think of it this way: the only car race you’re going to win by using old technology, is a classic car race. If you want to win in SEO in the next few years, I guarantee you’ll need to be on the Block Editor. If you’re not, and if some of your competitors are, they’re going to beat you.”

    Furthermore, WordPress is forcing people off older editors. For example, TinyMCE has been removed from WordPress core with versions 5.0+.

    While the classic editor plugin facilitates switching between Gutenberg and a standard editing view, it has an expected end of life of 2022.

    What does switching to Gutenberg require?

    Switching to Gutenberg is more than just a software upgrade. Of course an upgrade is required if you are using an older version of WordPress, but you will also need to consider things such as:

    • Designing the page layouts and block components you will use.
    • Learning to use the Gutenberg editor interface.
    • Migrating existing content from old content types to Gutenberg blocks.

    The right partner can help you get the most out of Gutenberg.

    Continuing to use ACF, Atlantic BT is able to develop custom blocks in Gutenberg with ease. For years, we have already been designing and developing with reusable components.

    Our teams have vast experience efficiently planning and building websites in this method.

    Ready to get started?

    If your WordPress website is built around a standard editor, you will benefit from switching to Gutenberg. Contact us for a free consultation to learn more.

  • What are my options for WordPress editors?

    WordPress is a popular CMS due to ease of customization, a large community, and SEO-friendliness. WordPress lists over 55,000 plugins available to customize your website, and new ones are constantly being added to the mix. There are many different ways to use a WordPress site, from eCommerce to local businesses and large university websites.

    Because of WordPress’ versatility, there are many ways of setting up the website for employees to make content adjustments. For example, employees could build new pages with a drag-and-drop interface, or they could simply select a pre-styled page template and enter content.

    In this article, we will cover these popular editor options:

    • Page builders
    • Advanced Custom Fields
    • Gutenberg

    While each editor has their own sets of pros and cons, read on to learn more about the different options available and which may be the best fit for your website.

    Page builders, bands, and blocks – which choice is best for me?

    The best editor to use in WordPress depends on several factors:

    • The complexity of web features
    • The complexity of design
    • The amount of control you want your users to have in design
    • What tasks users will need to complete in the admin

    Page Builder Plugins in WordPress

    Page builder editors are drag-and-drop interfaces that, generally speaking, make it simple for admin users to design pages however they envision. Users will not experience constraints in design.

    Some popular page builder plugins include Beaver Builder, WPBakery, Divi, and Visual Composer. These drag-and-drop editors work best with a simple design and very basic websites.

    The primary benefit of using a page builder is that editors can create highly customized pages without any HTML or CSS knowledge. Additionally, if editors need to have full control, page builders give them the capability of overriding templates with their design changes.

    As long as the design is simple, editors can easily drag and drop content blocks and elements into a page to style how they like.

    Page Builder plugins work well when:

    • Design is simple
    • Admin users need full control of layouts and design elements
    • Developers do not make frequent design updates

    ACF Flexible Content in WordPress

    However, there are downsides to giving too much flexibility for admin users. Giving full control can create issues with branding guidelines and consistency in design across pages. It also creates constraints for developers, making frequent updates difficult and increasing technical debt over time.

    At Atlantic BT, we often find that ACF plugin with Flexible Content fields hits the sweet spot, giving clients some layout control while staying within brand and accessibility constraints.

    Each page is defined by a template, and each template has its own set of available bands. While bands are pre-styled by developers, editors can choose which bands to add to a page and the order in which they will display. They also have full control over the content added to each band.

    For example, there may be 10 bands available to use for a marketing landing page. A marketer can choose which of these 10 bands to use on the page, what content will display within, and what order the bands will display.

    ACF is especially useful when:

    • A website reuses components across pages
    • Developers will need to make frequent updates (they will experience less constraints than with page builders)
    • Companies adhere to strict brand guidelines, but need flexibility in updating content

    Gutenberg in WordPress

    Gutenberg is a new editor which uses blocks within pages. Users can drag blocks into the page, similar to a page builder, and customize with a visual editor. However, users still will not experience the full control that they do with page builders.
    Gutenberg includes a library of pre-made blocks, giving users many options for creating page layouts. Still, HTML and CSS knowledge is necessary for full customization.

    As an alternative, developers could also create custom Gutenberg blocks either through code or using the latest version of ACF.

    Some handy editor features of Gutenberg include:

    • Easily create reusable blocks, like a blog post CTA
    • Drag and drop an image to automatically create an image block
    • Easily style cover photos for blog posts with overlays and parallax effect
    • Quickly create multi-column content
    • Create tables inside articles

    Gutenberg was initially released in December of 2018. WordPress has worked out many of the kinks over time to boost this editor’s increasing popularity.

    What does Atlanticbt.com use?

    Atlanticbt.com currently uses a flexible band system with ACF. As we are continually testing new layouts with users, we find that ACF is the best system to facilitate developers making frequent updates.

    Furthermore, the bands are styled to be accessible and ADA compliant, brand consistent, and reusable across the website.

    Need help with your WordPress setup?

    If you are unsure of the best editor options for your WordPress site, need help learning how to use your current site, or are interested in upgrading – one of our experts is ready to help you get started. Contact us to set up a free consultation.