Posted on Leave a comment

CI/CD with WordPress

What is CI/CD?

Continuous integration (CI) and Continuous Delivery (CD) are a set of operating principals and best practices that allow teams to deliver changes to their applications faster and more reliably. Generally known as CI/CD or CI/CD Pipeline, this is an Agile best practice and an excellent way for teams to optimize their application deployments.

Continuous Integration

Continuous integration (CI) is the first part of CI/CD and consists of a set of best practices that enforce frequent check-in of code to version controlling repositories. This is important as many new applications consist of multiple components developed across many platforms and tools. To avoid the overheads of frequent commits and releases, CI provides ways to build and package applications quickly, so that teams can collaborate and test changes more frequently.

Continuous Delivery

Once CI is done, Continuous Delivery (CD) picks up the process and delivers new releases to relevant infrastructure through automated channels. It stores environment-specific parameters pertaining to the many environments that teams work with, such as dev, staging, and production. It then automatically pushes changes along the workflow as they are tested and accepted.

CI/CD with WordPress

One of the best things about WordPress websites is that almost anyone can manage them, despite not having any coding knowledge. Front end editors and WordPress plugins make this possible. But if your website is being updated constantly with new features and changes or a web developer who manages one or more websites of your clients, then the CI/CD process can save you a lot of time.

WordPress is no different from any other web application. It consists of code files and other static resources such as images, CSS, and JavaScript files. Introducing a CI/CD pipeline can save you time and streamline the change process.

A CI/CD Pipeline can also save you the time taken to transfer files via an FTP application like FileZilla and the additional time testing your changes and rolling them back in case of an error.

What are the tools/providers that help you with that task?

You’ll need two main types of tools to set up a CI/CD pipeline for WordPress. The first is a Version Controlling Service (VCS). This is a code repository (repo), with a few other useful features. All your code will be maintained in this repo, and you can use one of the most popular free version control services like GitHub or BitBucket, or set up your own in-house VCS.

The next step is the more important one, where you need to carefully select a CI/CD tool that suits your needs. The CI/CD tool will be triggered every time a change is made to the repo. It will process the changes, perform the necessary actions like preprocessing or packaging, and transfer the relevant files to the specified environment (Staging/Production, etc.).

Some popular options are:

Buddy CI/CD

GitLab

Branch CI

Setting up a CI/CD Pipeline for your WordPress website

This is not too difficult and requires just a few steps. Let’s look at using Buddy.

  1. Setting up Version Control
    Start by setting up your code in a VCS like GitHub. Maintain a “development” branch to commit your work in addition to the Master branch. Changes can be merged into the Master branch once they are approved.
    You will also need to disable front-end editors on WordPress, and its plugins as any changes done outside the VCS will be over-written with commits.
  1. Setup a Pipeline
    Buddy is free and quite user friendly. You can set it up with a buddy.yml file or use its GUI, which is even more intuitive. You can configure Buddy to perform many actions such as Lint PHP and JS code, preprocess CSS, and run npm commands for other frameworks.
  1. Deploying your changes
    Once all this is done, Buddy will transfer your new files to the relevant environment. A good practice is to have a separate Staging server on which you (or your clients) can verify that everything is working fine before merging changes to the Master branch and triggering an update to your Production server.
  1. Merging Database changes
    One of the more complicated parts of this process is updating your production database as it has continued to be modified in production while you made changes to a copy of it in your development environment. There are some plugins that can be used for this purpose. But you should look at setting up your own process to ensure that nothing is missed. You can read more about the complexities of this step, our solution, and some existing plugins here.
    In brief, we create a SQL or PHP script to migrate the database changes and commit it to the repo, like any other change. In addition, we maintain a migration table to ensure that no script is duplicated or repeated. We then need to add a step in our build process to execute any new migration files after all the files have been copied. This approach does require a good understanding of how WordPress code manages the database, so you should stick to a plugin if you aren’t equipped for that.

We hope you enjoyed our quick guide regarding the benefits of CI/CD for your WordPress website.

Posted on Leave a comment

How to Fix WordPress 500 Internal Server Error

What can be more frustrating than a website working perfectly seconds ago displaying 500 Internal Server Error? If you are at this crossroad, this article will explain the steps you can take to fix the error. But before you start, it’s good to make a complete backup of your site. If you are ready, here we go!

Deactivate all Plugins and Themes

Go to your dashboard and deactivate all your plugins. Check the website again; if it loads without internal server error, it means the issue was with one of the plugins.  Switch them one by one to know the exact plugin that caused the error. Also, you can switch to the default theme. If your site loads without an error, then the issue was with the theme.

Turn on Debugging

Another way to get rid of the error is to turn on debugging. You can do this by editing your site’s wp-config.php file. Access the file and search for WP_DEBUG. If you find it, then, set it to “true” as shown below. If you don’t find it, write it yourself. Either way, you should have the line shown below.

define( "WP_DEBUG", true );

Check your .htaccess File

Use your FTP to access .htaccess file in your WordPress root folder. Create a back up of the file and then delete the original file. Check if your website is back without error. If it is, then, the .htaccess file has issues. Go through it line by line to get the offending line. You may have to delete the line.

Other Options

If all the solutions discussed above did not bring the website back live. You can try other options like increasing your WordPress memory limit, clearing your browser cache, checking your server logs, or reinstalling your WordPress core.

Posted on Leave a comment

Fixing Image Upload Issues in WordPress

One of the prevalent issues in WordPress is the image upload issue. Fortunately, it is quite easy to fix. Follow this article to the end to find out how.

Change file permission for upload folder

When your media gallery displays blank, here is a way to fix it.

Access WordPress files using the FTP. Locate wp-content; open the “Uploads” folder; right-click on it and choose File Permissions. Then set the number to 744; mark “recurse into subdirectories”, select “Apply to directories only” and click OK. Afterward, reload your library and try uploading an image. Note that in some cases, setting to 744 may not work; therefore, you can repeat the process but set the permission to 755.

Resize and Rename Image OR Increase Max file size

If you are unable to upload one image while others upload properly, there are two quick fixes for this. If it’s because of the image size, that means you need to resize the image. Also, you may need to increase the max file size.

Meanwhile, it may also be due to the name of the image as WordPress doesn’t allow special characters like ($, &, #, *, …); in that case, you will need to rename the image.

Increase the memory limit or Set Thread to on Processor

If you see an HTTP error when uploading an image, increasing the WordPress memory limit or setting an image processor to use one Thread can help fix the issue. To increase the WordPress memory limit, access your site with FTP; open the folder containing the WordPress files and locate wp-config to input the code: define(‘WP_MEMORY_LIMIT’, ‘256M’)

Other Solutions

The other solutions you can try include:

  1. Use your browser uploader for your image. In your WordPress dashboard, go to Media > Add New and click browser uploader.
  2. Clear browser and WordPress cache.
Posted on Leave a comment

How to Fix “Error 404 Not Found” in WordPress

Error 404 Not Found is one of the most frequent errors in WordPress. It happens majorly when you navigate from the Homepage to another page of your website. If you get this error, you can fix it in three ways as discussed below:

Reset Your WordPress Permalinks

To reset your WordPress Permalinks, you need to change it temporarily to default and thereafter change it back to your previous permalinks.

Access your WordPress Dashboard; go to Settings > Permalinks; select Default settings and click Save Changes. Afterwards, you can go ahead to select previous permalinks type and save your changes once again. Now, reload the pages that initially brought up the error to see if the issue has been fixed.

Modify .htaccess

If the error still persists, you need to edit the .htaccess file. This can be done by accessing the file through FTP. All you need do is to navigate to your WordPress root folder and look for the .htaccess file. Right click on the file and select View/Edit. Replace the code with the one provided below.

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# End WordPress

Disable WordPress Themes and Plugins

If the second method still doesn’t solve the issue. You may need to disable your WordPress themes and plugins. To do this, access your dashboard; go to Plugins > All Plugins and follow the process below to disable the plugins. For each plugin, click Deactivate and check the site to see if error 404 has disappeared. If the error still persists, re-activate the plugin you disabled and move on to deactivate the next one. Repeat the process till you find the plugin responsible for the problem or till you are done with all the plugins.

If you don’t have access to your dashboard, you can use FTP to locate the plugins and themes’ folders in the public_html/wp-content directory. Open the plugin folder and rename the folders in there; this will disable each of the plugins. Do the same for the themes’ folder.

Posted on Leave a comment

Pros and Cons of Setting up an Online Store with WooCommerce in WordPress

WordPress and WooCommerce

WordPress is an open-source Content Management System (CMS). It is free to install, deploy, and upgrade. WordPress has thousands of plugins and templates of flexible and simple templates that reduce development costs and development time.

WooCommerce is a plugin that helps to build a customizable eCommerce platform on WordPress.It is the world’s largest and most famous eCommerce platform at present.  It allows WooCommers users to create visually appealing and fully functional online storefronts right inside an existing WordPress-powered site. 

Setting up an online store in WooCommerce 

A person who wants to create an online store needs a platform capable of handling all the stages of retail transactions. Therefore they can set it up on WordPress using WooCommerce. 

Firstly, the user needs to have a domain name, web hosting, and an SSL certificate. The domain name is the website’s (online store) address on the internet, web hosting is where your website lives on the internet, and an SSL certificate adds a special security layer on your website.

Then the user needs to install WordPress and WooCommerce plugin. The user can set up the WooCommerce store by selecting a theme and adding information such as currency, payments, products, shipping information, etc. Finally, the user can extend the online store with plugins. There are over 46 000 plugins in WordPress and users can use suitable plugins among them.

Pros and Cons of WooCommerce in WordPress

Pros of WooCommerce

  1. Free of cost
    WooCommerce is cost-effective because the core software is free. People who want to start their own online business without a big investment can set up their online store on WooCommerce at no cost.

  1. Maximum control and 100% customizable
    Users of WooCommerce can customize their online stores according to their business requirements. There are thousands of themes in this platform and users can customize the sessions such as headers, footers, product sheets with the aid of those themes. WooCommers allows users to freely access the CSS, HTML, and PHP style codes and users can create unique designs for their stores.

  1. Greater flexibility
    Online shoppers can add a large number of product lists divided into different categories on their websites. Not only that, but WooCommerce can also be configured to sell physical, virtual, or downloadable products. It offers the ability to accept almost all sorts of payments.

  1. Large community
    WooCommerce has a large community of users, developers, and contributors. In current society, WooCommerce users can find plenty of documentation, articles, and informative guides because of that large community. In case of technical or nontechnical problems, the store owners can receive help from a large community. 

  1. Easy to use
    There are plenty of WooCommers guides that can be found around the internet with prompts, Supports, Q&As. So, not only software experts but also beginners of WooCommerce can use it with the help of those guides.

  1. Integration with WordPress
    WordPress software powers more than 1/3rd of the entire Internet. WordPress is popular and it has a huge community supporting it. WooCommerce benefits from all those three reasons because of WooCommerce’s origin as a plugin of WordPress. 

  1. WordPress is fast
    WooCommerce is combined with performance-optimized WooCommerce hosting. That performance-optimized WooCommerce hosting is specifically engineered to maximize performance. So, WooCommerce provides fast and responsive eCommerce for all of their online stores.

  1. WordPress grows with its businesses
    In the beginning, a business can be small. But over time, as the business progresses, it can grow into a larger business. It’s better to think about the future of the store when choosing an eCommerce application for it. 
    WooCommerce supports its online stores ranging from the tiny to the immense. It can scale from a couple of items to a huge number, and from a bunch of customers to many customers.

Cons of WooCommerce

  1. Need to pay for extensions
    The installation of WordPress, WooCommerce plugins, and most of its widgets are free, but the installation of some extensions may require a punctual payment or the hiring of plans with monthly fees. Online store owners don’t need to pay for launching their websites. The development of the business with the time, shop owners may need to expand the site. Therefore they need extensions and for them, the owners have to spend money.

  1. Plugins and plug-in can hamper the old excellent performance
    Mostly this happened for the less experienced users. Installing too many plugins and extensions takes up a lot of memory. Then the downloading speed and overall performance may decrease. 

  1. Technical maintenance
    This disadvantage comes directly from the benefit of maximum control. That freedom comes with maximum responsibilities. The online store owner is responsible for maintaining the website successfully  

  1. Can’t use without WordPress
    WooCommerce is reliant on WordPress. If an online store user doesn’t use WordPress, he/she won’t be able to use WooCommerce.

  1. No customer service
    Most of the online resources traditionally have customer service to help. WooCommerce doesn’t have traditional customer service. Even so, there are plenty of online resources to help set up the WooCommerce and troubleshoot any issues.

Conclusion

Although building online stores with WooCommerce has some cons, you can understand these cons are common for most plugins. Also, it’s clear that pros outweigh the cons by a big margin. That’s why WooCommerce powers most of the online stores on the internet. However, as your business grows, you will have to buy extensions. We will cover these extensions in a new article in the near future.

Posted on Leave a comment

What Types of Testing are Useful for WordPress?

For any application or system that will be put to use, there is a need to first carry out a test. In fact, this is a fundamental axiom and it is true in all ramifications. When it comes to WordPress, the different types of tests have consistently increased over the years. Therefore, this article will discuss the various testing types that can be utilised for WordPress.

What is Testing in Web Development?

Testing is the use of various tools or means to make sure that changes to your code or website are working as expected. 

Testing Types

To ensure that the changes you make to your code work very well, there are several testing types that you can use. Each type of testing has its features, advantages, as well as its  disadvantages. However, in this article, we have covered the testing types most suitable for WordPress.

Manual or Automated Types

Manual testing is done by an individual clicking through the application or interacting with the software and APIs with the appropriate tools. It is costly as it requires someone to set up an environment and execute the tests themselves, and it is prone to human error because the tester can omit steps in the script or make typos.

Automated tests are more robust and reliable than manual tests. They are carried out using a machine that executes a test script already written, meaning that the quality of your automated tests largely depends on how well the test script has been written.

Automated testing is a crucial component of continuous integration and continuous delivery, and it’s a great way to scale your application as you add new features to it. But one can not underestimate the value in doing some manual testing.

Now lets, zoom into specific kinds of testing;

Unit Testing

Unit testings are very low-level tests, close to the source of your application. They consist of testing specific methods as well as functions of the classes, modules or components used by your software. Unit tests can be run quickly using a continuous integration server, and they are generally cheap to automate.

Unit testing is useful for WordPress core and Plugin Development. This is possible because the goal of unit testing lies in the actual code and module components of development. It is an essential testing done by developers. In more precise terms, Unit testing can be seen as a foundation for all other tests.

Integration Testing

Integration tests help in verifying that the services and modules used by your application are working together as expected. For instance, you may be testing the interaction with the database or trying to make sure that microservices work well together. Integrated tests are generally expensive to run as there is a need to have multiple parts of the application up and running. 

The relevance of Integration testing in WordPress is significant; however, since it’s expensive, the bulk of integration testing is done by the WordPress community, usually from the source of development. 

Functional Testing

Functional tests have a direct focus on an application’s business requirements. The tests only verify the output of action and never check the system’s intermediate states when performing the action.

Although both functional and integration tests require interaction between multiple components of the application, there is a difference between them. While an integration test will verify that you can query the database, a functional test would expect to have a specific value from the database clearly defined by the product requirements.

End-to-End Tests

End-to-end testing replicates a user behaviour with the software in a complete application environment. The tests verify that different user flows work as expected. This can be as simple as loading a web page or logging in or much more complex scenarios checking email notifications, online payments, etc.

End-to-end tests are handy, but they’re expensive to perform and can be hard to maintain when they’re automated. It is recommended to have a few critical end-to-end tests and rely more on low-level types of testing (integration and unit tests) to identify breaking changes quickly.

Similar to system testing, End-to-End Testing involves testing of the complete application environment in a way that mimics real-world use, such as using network communications, interacting with a database, or interacting with other hardware, applications, or systems if appropriate.

At this juncture, we must emphasise that Functional testing is the same as End to End testing for us. This checks that the whole software is working. Some may even categorise this as System testing.

Why not Do Everything with End-to-End Testing?

Well, the downside to this is that it is too slow and not cost-effective. Therefore, for a large project, it might take too much time and money. However, for small projects, it is sufficient.

Other Testing

For the essence of completion, here is a list of other testings that may be useful in WordPress;

  • Performance Testing
  • Load Testing
  • Security Testing
  • Compatibility Testing
  • Install Testing
  • Recovery Testing

Conclusion

To conclude this article, it is essential to discuss the primary objective of testing. First, is to ensure that users can truly make use of an application. Second, is to check that your system does not break when unexpected actions are performed. What will happen when a user makes a typo, uses the wrong API or tries to save an incomplete form? These are the reasons for the test. In addition, you need to ensure that no one can easily compromise the data or get inappropriate access to resources. An excellent testing suite like one provided by Testup will be of great value.