Tag: tutorials

  • How to Display Author’s Twitter and Facebook on the Profile Page

    Want to display your author’s Twitter and Facebook links on their WordPress profile page?

    By default, WordPress user profile pages don’t include fields for adding social media profiles such as Facebook or Twitter.

    In this article, we will show you how to easily display your author’s Twitter and Facebook profile links in WordPress.

    How to Display Author's Twitter and Facebook on the Profile Page

    Why Display Author’s Twitter and Facebook Profiles on Your Site?

    Social media platforms are an important source of traffic for your WordPress website. That’s why we put together a social media cheat sheet that will help you set up your social media profiles the right way.

    Your authors will also have their own social profiles, and you can display them on your site to build credibility with your readers and strengthen your site’s authority.

    Your visitors will be able to follow their favorite authors on social media and discover new articles on your site sooner. You can also add their social media profiles to your site’s schema, boosting your site’s trust score on Google and other search engines.

    With that being said, let’s take a look at how to display an author’s Twitter and Facebook links on their user profile page.

    Some of the best WordPress themes will display an author info box below each article. You can use this feature to display simple links to your author’s social profiles.

    Simply go to Users » All Users in your WordPress admin panel and click the name of the author, or the ‘Edit’ link underneath to open the Edit User page.

    Click on a User in the All Users List

    Next, you should scroll down to the ‘About the user’ section and look for the ‘Biographical Info’ box.

    If it is there, then your theme has built-in support for an author box.

    Adding HTML Social Links to the User Bio

    Here you can type a description of the author using text or HTML. You can manually add HTML links for the author’s Twitter and Facebook profile URLs, like this:

    ADD BIO HERE. Follow them on <a href="https:/twitter.com/USERNAME">Twitter</a> and <a href="https://facebook.com/USERNAME">Facebook</a>.
    

    Make sure you add a short biography about the author and change ‘USERNAME’ to their actual Twitter and Facebook usernames.

    Once you’re finished, don’t forget to scroll to the bottom of the page and click the ‘Update User’ button to store your settings.

    You will now see Twitter and Facebook links with the user’s bio on the posts that they write. Here’s how it looks on our demo website:

    Preview of Author Bio with Twitter and Facebook Links

    Method 2: Displaying Social Icons With an Author Bio Box Plugin

    If your theme doesn’t display an author bio box, or if you want one that is more customizable and displays social icons instead of links, then you can use a plugin.

    Simple Author Box is the best free author bio box plugin. It lets you customize nearly every aspect of your author bio box, including adding social media links for your authors.

    First, you need to install and activate the Simple Author Box plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

    If you want even more features, then there’s a pro version that lets you display an author box before or after content, add website links, get more social icon styles, include guest authors and co-authors, and more.

    Upon activation, the plugin adds social media fields to each user profile. Simply navigate to the Users » All Users page in your WordPress admin area and click on the author’s name or the ‘Edit’ link below.

    Click on a User in the All Users List

    Tip: To quickly edit your own user profile, you can go to the Users » Profile page.

    When you scroll to the bottom of the author profile, you will notice some new fields that have been added by the Author Bio Box plugin.

    Scroll until you see the section labeled ‘Social Media Links (Simple Author Box).’ Now you need to select ‘Facebook’ from the drop-down menu, and then paste the URL to their Facebook profile into the next field.

    Adding a Facebook Profile Using Author Bio Box

    Now you can click the button labeled ‘+ Add new social platform.’

    A new drop-down and field will be added where you can add their Twitter URL.

    Adding Facebook and Twitter Links Using Simple Author Box

    Once you’ve done that, make sure you click the ‘Update User’ button to store your settings.

    Note: Don’t worry if the Facebook and Twitter URLs vanish after clicking the button. At the time of writing, there is a minor bug that hides the URLs, but the settings have been saved.

    Now Facebook and Twitter icons will be displayed with the author’s profile at the bottom of their posts. Clicking these icons will take your visitors to their social profiles, but these links will open in the same window as your blog.

    Preview of Simple Author Box with Social Icons

    If you would prefer that the links open in a new tab, then you can navigate to the Appearance » Simple Author Box page and then click on the Elements tab. Once there, you need to find the option to ‘Open social icon links in a new tab’ and toggle it to the on position.

    Open Simple Author Box Icons in a New Tab

    Now the author’s social profiles will open in a new tab.

    Method 3: Adding Social Profiles to Your Site’s Schema for SEO

    All in One SEO (AIOSEO) is the original WordPress SEO plugin that’s used on over 3 million websites. It can also be used to add social profile fields on the author’s profile page.

    Unlike the other methods, this method will improve your website’s SEO since AIOSEO adds these social profiles to your site’s schema markup.

    The problem is that AIOSEO does not automatically display them in the author bio. But don’t worry, we will show you how to do that.

    For this tutorial, we’ll use the free version of All in One SEO since it allows you to add social profiles for your website and each user. However, AIOSEO Pro offers even more features to help you rank better in search engine results pages.

    The first thing you need to do is install the free All in One SEO Lite plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

    Once you have the AIOSEO plugin set up, you need to head over to the Users » All Users page, and then click on the author’s name or the ‘Edit’ link just below.

    Click on a User in the All Users List

    This will open the Edit User page for that author.

    Notice that AIOSEO has added a Social Profiles tab at the top of the page. You need to click on that tab now.

    All in One SEO Social Profiles Tab

    You can now enter the URL to the user’s social profiles in the boxes provided, such as:

    https://facebook.com/johnsmith345
    
    

    Note that simply adding the username is not enough.

    Alternatively, if the author uses the same username on multiple social networks, then you can click the box labeled ‘Use the same username for multiple social networks.’

    Quickly Adding Multiple Social Networks With Same Username

    You can then type in that username and check the social networks it is used on. For other social networks, you can simply type the full URL as before.

    Once you are done, click on the ‘Update User’ button at the bottom of the page to store your changes.

    Pro Tip: If you have Twitter and Facebook profiles for your business or website, then you can add these to your site’s schema in a similar way by visiting All in One SEO » Social Networks and adding the links on the Social Profiles tab.

    The author’s social media profiles have now been added to your site’s schema, helping search engines understand your site better. But they are not yet being displayed on your website.

    Displaying AIOSEO Author Twitter and Facebook Links in Your Theme

    Now you need to display these fields as links in your theme.

    If you are an advanced user, then you can display links from All in One SEO’s social profiles by editing your WordPress theme files. If you haven’t done this before, then check out our guide on how to copy and paste code in WordPress.

    Note: If you’re not familiar with editing your theme’s core files and adding custom code, then we recommend you use AIOSEO to add the social profiles to your site’s schema, and then display them on your website using method 1 or method 2 above.

    Advanced users can add the following code to your theme files where you want to display the author profile links.

    <?php
    $twitter = get_the_author_meta( 'aioseo_twitter', $post->post_author );
    $facebook = get_the_author_meta( 'aioseo_facebook', $post->post_author );
    echo '<a href="' . $twitter .'" rel="nofollow" target="_blank">Twitter</a> | <a href="'. $facebook .'" rel="nofollow" target="_blank">Facebook</a>';
    ?>
    

    Save your changes and view a post on your website.

    Here’s how it looks on our demo website. We added the code snippet to the biography.php file in the template-parts folder of the Twenty Sixteen theme.

    Displaying AIOSEO Social Profiles in Your Theme Using Code

    We hope this article helped you learn how to display the author’s Twitter and Facebook profile links in WordPress. You may also want to see our guide on how to display recent tweets or how to display your Facebook timeline in WordPress.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Display Author’s Twitter and Facebook on the Profile Page first appeared on WPBeginner.

    Go to source

  • How to Improve the Performance of Large WordPress Sites

    If you’re running a larger WordPress site, you may be facing performance challenges that can impact user experience and search engine rankings. Fortunately, there are several steps you can take to improve your site’s speed and performance. This article covers some of the most common performance challenges for larger WordPress sites and provides tips and solutions for addressing these.

    Growing pains… some should be so lucky to have them!

    Let’s talk about how to manage a WordPress site that is growing too quickly too soon and causing you or your clients all sorts of pains and problems.

    If the issue is temporary, such as dealing with an unexpected traffic spike from a post gone viral (another thing we should be so lucky to experience!), then knowing how to scale your WordPress site when traffic soars can fix this.

    However, if problems persist, it may take more than a couple of aspirins and calling the doctor in the morning to make the headaches go away.

    In this article, we’ll cover:

    WordPress Enterprise Development Challenges

    Q: How complex can you make a WordPress site?

    A: Very.

    When it comes to building large and complex sites, WordPress’s capacity to handle it is not an issue. As WordPress enterprise developer and global SME business adviser Mario Peshev states in his excellent article on building large and complex sites using WordPress

    “WordPress is a proven CMS that handles various applications handling millions of users and tens or even 100M views a month.”

    As Mario also states…

    “Scaling from 10M to 50M is feasible, 50M to 100M is challenging, 100M–200M is quite complex and 200M+ may require some serious engineering effort.”

    So, the capacity of the WordPress CMS platform to handle large and complex sites is not a problem.

    The issue is having the skills to handle WordPress enterprise development challenges.

    As most developers know, WordPress is not only a widely popular content management system known for its flexibility, ease of use, and affordability, but it is also an excellent platform for small businesses and startups that want to establish a web presence quickly and easily.

    However, when it comes to enterprise-grade WordPress development, the amount of information available is as scarce as a developer who hasn’t resorted to cursing loudly at their code editor at least once.

    So, before we get into diagnosing the challenges and issues of dealing with large WordPress sites, let’s explore some of the challenges of finding relevant information on WordPress enterprise development.

    Here is a summary of the points Mario Peshev makes in his article…

    Scarcity of Information on Enterprise-Grade WordPress Development

    One of the main reasons why information on enterprise-grade WordPress development is scarce is that only a handful of agencies specialize in building WordPress platforms, applications, plugins, or performing migrations and integrations for the enterprise.

    Most vendors profile in small business websites, and only a small chunk of the service providers work with enterprises.

    Furthermore, those consultants and agencies often don’t have the time and resources to write tutorials and share their know-how with the industry, or they just don’t care, especially more hardcore engineers who don’t want to bother.

    Another reason why information on WordPress enterprise development is limited is that WordPress is often not the core application that enterprises use in the first place. It’s another obstacle for many, like working on the front-end interface as 1% of the main platform running behind the scenes.

    However, WordPress developers who want to bid on enterprise projects can focus on several different areas to enhance their expertise.

    Focus on Different Areas for Enhancing Expertise

    The first area that WordPress developers should focus on is studying the WordPress Core, APIs, and the surrounding ecosystem in-depth. This will give developers a deeper understanding of the platform and how it works.

    They should also make sure that they’re comfortable with WordPress coding standards and best practices. This will ensure that the code they write is maintainable and easy to read.

    The second area that WordPress developers should focus on is practicing in the main technical areas that enterprises care about, such as performance, security, scalability, and backward compatibility.

    Enterprises have high expectations, and it’s essential to demonstrate that you have the expertise to meet their requirements.

    These WordPress development resources will help you gain these valuable skills and expertise:

    Strategic Players in the Field

    Hosting vendors are strategic players in the field and occasionally work with high-scale applications. Developers can browse their resources and follow their blogs, knowledge base articles, and the like. WordPress is a platform built on top of PHP and SQL, front-end served through HTML, CSS, JavaScript. It runs on a web server like Apache or Nginx using mod_php or php-fpm, connected to a MySQL database on a Linux server.

    Most of the heavy lifting for enterprises happens on top of those layers. Therefore, it makes sense to dive deeper into their own communities and resources stressing on those topics.

    Follow WordPress Core Contributors and Employees

    It always helps to follow WordPress Core contributors, employees at enterprise-grade companies, and the blogs of the leading agencies working with enterprises. You may find some relevant case studies, interviews with clients, or other top engineers that could help you improve even further.

    Now that we’ve looked at the first challenges, which is acquiring the expertise to handle large and complex WordPress sites and meeting the expectations of enterprises, let’s turn to addressing common performance issues you may experience working with large WordPress sites.

    Common Performance Challenges for Large WordPress Sites

    WordPress is used by some of the biggest and most well-known companies, celebrities, and brands in the world, like Intel, Pepsi Cola, PlayStation, American Express, TechCrunch, Fisher-Price, Beyonce, Justin Timberlake, Usain Bolt, and many more.

    Someone has to look after these large sites… why not you?

    While browsing through WPMU DEV’s member forums (which, by the way, is a treasure trove of information for web developers), I came across this post from WPMU DEV member Charly Leetham, which I am reproducing in full below:

    ***

    I was contacted by a long term client asking for assistance with their client.

    The end customer is setting up a rather large website in WordPress and they were having no end of difficulties in keeping the site running. It was so bad, that they had to reboot their Amazon EC2 instance regularly (several times a day regularly).

    With trepidation I agreed to take a look and see if I could help. What I found has left me … saddened. For the client, mostly.

    The site:

    • Database: 4Gigabytes (after optimization)
    • Posts / Pages and other content: Over 900K entries.

    This is not a small site.

    It was built in Elementor which initially left me concerned, as I know that Elementor is resource hungry.

    The EC2 instance was provisioned with 140 Gig storage and 32 Gig memory. More than enough, right? One would think so.

    The business had been moved to EC2 by a consultant who had promised them it would improve their performance. Then they told them that the reason the instance kept hanging was because of the high number of transients that were being created.

    They created a cron job that deleted the transients every hour and with very little improvement.

    I’ve found a number of things during my investigations but the three most concerning things are:

    1. Although the server was provisioned with 32G of memory. PHP had been limited 2G and WordPress had been limited to 40M.

    It’s no wonder they were having trouble.

    Increasing these limits has stopped the hanging but we’re still experiencing memory overflows.

    2. The database was provisioned on the same server.

    Splitting the database onto a RDS (remote database server) should provide more performance increases.

    3. No optimization or performance improvement work had been done.

    By implementing Hummingbird, I’ve been able to improve the load time of the site and that’s without doing anything really hard core. That’s still to come.

    The main thing I want to highlight for others here, is that it’s the incremental knowledge you bring to the table when working with clients.

    Yes, people can build their own WordPress sites but few people can really make them hum. That takes experience and a lot of work.

    ***

    Charly’s forum post is a great example of some of the typical performance challenges you can expect when working with larger WordPress sites and provides a number of useful insights into handling these.

    To address these challenges, let’s first summarize the main technical issues Charly described when looking at this client’s site:

    1. The end customer is setting up a rather large website in WordPress with over 900k entries and a 4GB database after optimization, which is not a small site.
    2. The website was built in Elementor, which is resource-hungry and requires a lot of server resources.
    3. The EC2 instance was provisioned with 140GB storage and 32GB memory, but PHP had been limited to 2GB and WordPress had been limited to 40MB, causing performance issues and memory overflows.
    4. The database was provisioned on the same server, which caused performance issues. Splitting it onto a remote database server should provide performance improvements.
    5. No optimization or performance improvement work had been done. By implementing Hummingbird, Charly was able to improve the site’s load time.
    6. The incremental knowledge and experience brought to the table by an experienced web developer is crucial for optimizing and improving the performance of WordPress sites, which can be complex and require a lot of work to make them run smoothly.

    We’ve already addressed point #6, so let’s go through the other issues on the list above.

    Large WordPress Site Performance Issue #1 – WordPress Database

    As your WordPress site grows, so does the size of its database. Your WordPress database can become quite large and may start causing some issues.

    Managing a large WordPress database can be a daunting task, so let’s take a look at some of the challenges, best practices, strategies, and solutions for managing your WordPress database on larger sites.

    The challenges of having a large WordPress database include:

    • Slow page load times: A large database can slow down your website, making it difficult for visitors to load pages quickly.
    • Backup and restore issues: Backing up and restoring a large database can be a challenge, and it may take a long time to complete the process.
    • Database corruption: A large database can be more prone to corruption, which can cause data loss and other issues.
    • Difficulty in database maintenance: Maintaining a large database may require more resources and expertise to keep it running smoothly.

    Here are some strategies and best practices managing WordPress databases on larger sites:

    Initial Configuration

    Before you even start thinking about managing your database, it’s important to make sure that it’s set up correctly. When you install WordPress, it creates a new database for you. However, if you’re running a large site, you may want to consider using a separate database server. This will help to improve performance and reduce the load on your web server.

    When configuring your database, it’s important to choose the right settings. In particular, you’ll want to pay attention to the database character set and collation. These settings can affect how your content is displayed on your site, so it’s important to get them right from the start.

    Where to Keep the Databases

    When managing a large WordPress site, you’ll want to think carefully about where to keep your databases.

    There are a few different options to consider:

    • Local Database: You can keep your database on the same server as your website. This is the simplest and most common option, but it can lead to performance issues as your site grows, as Charly referred to in the client example above.
    • Remote Database: You can keep your database on a separate server, either within your own network or in the cloud. This can improve performance, but it can also increase costs.
    • Managed Database: You can use a managed database service, such as Amazon RDS or Google Cloud SQL. This can be a good option if you don’t have the expertise to manage your own database.

    Database Access Time with Large Numbers of Records

    As your WordPress site grows, the size of your database can have an impact on how quickly your site loads.

    When you have a large number of records in your database, queries can take longer to run, which can slow down your site.

    Caching can help speed up your website by storing frequently accessed data in memory, reducing the need to access the site’s database and PHP. This, of course, depends on the kind of caching being used, e.g. database caching (which includes object caching) or page caching (where the cache of the web pages is stored and presented when a specific page is requested later without needing to be processed by PHP and MySQL).

    To improve performance, you can use server-side caching, caching plugins that manage server-side caching solutions, or standalone caching plugins. Our performance-optimizing plugin Hummingbird, for example, has its own caching but also integrates with WPMU DEV’s server-side caching.

    Caching can have a significant impact on site performance, particularly for larger sites. However, setting up and managing caching can be complex and time-consuming.

    Also, it’s important to regularly monitor your site’s performance to ensure the caching is optimized for your specific needs.

    To learn more about caching solutions, check out our Ultimate Guide to WordPress Caching.

    Another option is to use a technique called “sharding,” which involves splitting your database into smaller pieces. This can help to improve performance by spreading the load across multiple servers.

    Techniques for Splitting the Data Up

    If you’re using a technique like sharding, you’ll need to decide how to split your data up. One option is to split your data by category or tag. For example, you could have one database for posts related to technology, and another for posts related to entertainment.

    Another option is to split your data by date. This can be particularly useful if you have a lot of older content that doesn’t change very often. You could have one database for posts from the last year, and another for older posts.

    Consider also using a plugin like HyperDB. HyperDB is maintained by Automattic, the parent company of WordPress.

    As described on the plugin page…

    HyperDB allows tables to be placed in arbitrary databases. It can use callbacks you write to compute the appropriate database for a given query. Thus you can partition your site’s data according to your own scheme and configure HyperDB accordingly.

    Basic Indexing

    Indexing your database can help to improve performance by making it faster to search for data. When you create an index, the database creates a data structure that makes it easier to search for specific values.

    To create an index, you’ll need to use the MySQL command line or a tool like phpMyAdmin.

    When you’re creating an index, it’s important to choose the right columns to index. Typically, you’ll want to index columns that are frequently used in queries.

    You can also use a plugin like Index WP MySQL for Speed. This plugin adds database keys (also called indexes) to your MySQL tables to make it easier for WordPress to find the information it needs. The plugin page also includes excellent information on database indexing in relational database management systems.

    Settings and Logs to Check

    To keep your database running smoothly, there are a few settings and logs that you’ll want to keep an eye on. These include:

    • MySQL slow query log: This log records queries that take longer than a certain amount of time to run. By analyzing this log, you can identify queries that are causing performance issues.
    • MySQL error log: This log records any errors that occur in the MySQL server. By monitoring this log, you can identify and troubleshoot issues that may be affecting your database.
    • WordPress debug log: This log records any errors or warnings that occur within WordPress. By monitoring this log, you can identify issues with your WordPress installation or plugins.
    • Database backups: Regularly backing up your database is important to ensure that you don’t lose any data in case of a server crash or other disaster and can restore your website quickly in case of a problem. You can use a plugin like Snapshot to automate this process, or if you’re hosting with WPMU DEV, you can configure automatic enterprise database backups to perform daily and even hourly. Also, consider storing all backups separately from the server hosting the site, as the backups may be lost if the server crashes.

    Other Ongoing Maintenance

    In addition to the above, there are a few other ongoing maintenance tasks that you’ll want to perform to keep your database running smoothly.

    These include:

    • Cleaning up your database: Over time, your database can become cluttered with unused data. Check our article on how to clean up your database and remove unnecessary data for more details.
    • Optimizing your database tables: Reducing the size of your database and optimizing your database tables helps to improve site performance. You can optimize your database by removing unnecessary data, such as post revisions, trashed items, spam comments, and unused plugins and themes. Check our complete WordPress database optimization guide for detailed instructions and plugins that help you do this.
    • Monitoring your site for security issues: Large sites are often a target for hackers. You can use a plugin like Defender to monitor your site for security issues and prevent attacks.

    In terms of cleaning up your database, Charly mentions a high number of transients as being a possible issue affecting the site’s performance. Although addressing this issue seemed to offer very little improvement in Charly’s client’s case, it’s worth mentioning it here as something to check if you are experiencing issues with your site.

    Transients are a type of cache that stores data in the database for a specific period of time. They are used to speed up the loading time of a website by storing the results of a complex or time-consuming query, such as an API request, so that the query doesn’t have to be run every time the page is loaded.

    Transients have a set expiration time, after which they are automatically deleted from the database. However, if the website is not properly optimized, transients can accumulate in the database and cause performance issues, such as slow page loading times or database crashes.

    To optimize WordPress and avoid issues with transients, there are several steps that can be taken. These include:

    • Use a caching plugin: A caching plugin like Hummingbird can help reduce the number of database queries and prevent unnecessary creation of transients.
    • Delete expired transients: Expired transients can accumulate in the database, so it’s important to regularly delete them to keep the database optimized. This can be done manually, or by using a plugin like Hummingbird.
    • Set a maximum lifetime for transients: By setting a maximum lifetime for transients, you can prevent them from being stored in the database for too long, which can lead to performance issues. This can be done using the set_transient() function in WordPress.
    • Use a remote database: Storing the database on a remote server can help reduce the load on the server and prevent issues with transients.
    • Increase the memory limit: Increasing the memory limit for PHP and WordPress can help prevent memory overflows and performance issues caused by transients.

    No matter what size WordPress site you are working on, using WPMU DEV’s Hummingbird caching and site optimization plugin can help to automatically take care of expired transients and eliminate this issue, leading to faster page loading times and a smoother user experience.

    Hummingbird: Advanced Tools screen with Database Cleanup and Transients options highlighted.
    Hummingbird can be configured to automatically delete expired transients from your WordPress database.

    In terms of increasing the memory limit for PHP, if you are a WPMU DEV member, it’s really easy to check a whole bunch of information about your WordPress site, include current PHP memory limits and max filesize upload settings.

    Just log into your WordPress dashboard and navigate to the WPMU DEV dashboard plugin menu. Select Support > System Information > PHP tab.

    WPMU DEV Dashboard plugin - Support tab.
    WPMU DEV’s Dashboard plugin lets you easily check information about your WordPress site.

    If you are not a WPMU DEV member, you can still check this information manually.

    To find out how much php memory is allocated, create a php and add the following:

    <?php
    phpinfo();
    ?>

    Call it something like php-test.php and upload it to your server.

    Access the file from a browser and search for memory_limit. This will give you two settings – what the local site settings are and what the server default is. It is possible to have different php memory_limits by site.

    For WordPress memory, for instance, you might see the following:

    define('WP_MEMORY_LIMIT', '64M');

    Note that if this entry is missing in the wp-config.php file, then your site is probably working between 40M and 64M.

    In addition to the above, make sure to also scan and fix corrupt or broken files and database in WordPress.

    As you can see, there are quite a number of things you can do to improve the performance of your WordPress database.

    Let’s move on, to…

    Large WordPress Site Performance Issue #2 – WordPress Core, Themes, And Plugins

    Charly mentions that another possible reason for the performance issues her client’s site was experiencing was using a resource-hungry theme.

    Rather than focusing on a particular theme, let’s look at themes and plugins in general (btw… if you use Elementor, check out our article on how to optimize Elementor themes. We’ve also written articles on ways to optimize themes like Divi, WPBakery, Astra, and other page builders.)

    Here are some of the things you can do:

    Theme and Plugin Bloat – Themes and plugins can significantly impact the performance of a WordPress site, particularly if they are not optimized or updated regularly. Some themes and plugins can also be poorly coded, leading to slow loading times and site bloat.

    Solution: Be sure to choose a lightweight and optimized theme that is regularly updated by the developer. Avoid using too many plugins and remove any unnecessary ones to reduce site bloat. Always keep your themes and plugins up-to-date to ensure optimal performance.

    • Avoid poorly coded themes and plugins, as these can lead to slow loading times, site bloat, and conflicts.
    • Choose lightweight and optimized themes and plugins that are regularly updated by their developer.
    • Check your server logs to identify heavy plugins and themes that could be slowing down your site.
    • Always keep your themes and plugins up-to-date to ensure optimal performance.
    • Deactivate and remove unnecessary and non-essential plugins and themes.

    As with all WordPress sites, regardless of size, it’s also really important to optimize your client sites.

    There are a number of tools you can use to scan your site and measure site performance, including Google PageSpeed Insights and GTmetrix. These tools provide important insights into ways to optimize your sites.

    You can also use a developer tool plugin like Query Monitor to help you identify issues, aid in the debugging of database queries, PHP errors, hooks and actions, block editor blocks, enqueued scripts and stylesheets, and HTTP API calls. The plugin also provides advanced features such as debugging of Ajax calls, REST API calls, and user capability checks.

    Query Monitor - WordPress plugin
    Use Query Monitor to quickly identify poorly performing plugins, themes, or functions in your WordPress site.

    Additional articles and tutorials that we recommend checking out include our guide on speeding up WordPress, solutions to forgotten WordPress page speed problems, WordPress troubleshooting guide, and Mario Peshev’s article on scaling mistakes when running a large WordPress site.

    Large WordPress Site Performance Issue #3 – Site Content

    Large WordPress sites typically have loads of content. In Charly’s case, for example, the client’s website had over 900k entries.

    If you’ve gone and optimized the database and you’re still experiencing issues, here are some of the things you can look at:

    • Perform a content audit: A content audit is essentially performing an inventory of your existing content and assessing and identifying content that’s outdated, obsolete, duplicated, etc, before deciding what to do with it (e.g. update, SEO optimize, trash). It’s a long-term but effective and important strategy for keeping your site’s content manageable and maintained.
    • Use lazy loading: Lazy loading can help to ensure that media files are only loaded when they are needed, which can significantly improve page load times.
    • Use a content delivery network (CDN): Consider using a content delivery network (CDN) to distribute cached media files and reduce the load on your server. A CDN can help speed up your website by caching your website’s content on servers located around the world, reducing the load on your server. Popular CDNs include Cloudflare and MaxCDN. Note that all WPMU DEV membership and hosting plans include a CDN. Our Hummingbird and Smush plugins also include a CDN (Hummingbird also offers Cloudflare integration).
    • Use content optimization plugins: Optimize images, videos, and other media files by compressing them and reducing their file size. If the site contains loads of images, consider using an image optimization plugin like Smush, which significantly reduces image file sizes without compromising on image quality to improve content delivery performance. Smush also includes WPMU DEV’s CDN.
    • Use a managed WordPress hosting service: A managed WordPress hosting service can provide you with optimized servers and database management tools to help keep your website running smoothly. As discussed in the next section below, WPMU DEV not only offers a best-of-class managed WordPress hosting service, but it is also specifically configured to deliver enterprise-level hosting for WordPress sites of all kinds and sizes.

    Large WordPress Site Performance Issue #4 – Hosting

    If you are still experiencing problems with the site after fixing issues with the WordPress database and optimizing the site’s core, plugins, themes, and content, the issue may be related to web hosting.

    Consider using a managed WordPress hosting service with a company that specializes in WordPress.

    Hosting with a reputable host not only means placing your site in the care of an experienced team who will handle areas like server optimization and database management for you, but also migrate your existing website to their servers.

    This is very important, as a large WordPress site no doubt has lots of moving parts and active traffic and transactional events taking place, and you don’t want to lose any valuable data or break anything during the migration process.

    Additional hosting considerations for a large WordPress site include the ability to handle demands with ample resources, uptime, speed, and customer support.

    WPMU DEV offers enterprise-level hosting, 24/7 expert hosting and WordPress support, and migrations by a team of experts who will handle everything for you, including troubleshooting any potential issues with your site.

    Additionally, WPMU DEV has been independently rated and reviewed by many users as one of the leading managed WordPress hosting companies, with a near-perfect rating score. G2.com, for example, rates WPMU DEV 4.8 out of 5 stars overall, and 9.8 out of 10 for quality of support.

    More importantly and on a practical level, our expert team proactively manages larger sites by regularly checking areas like “PHP error logs” for any errors in the plugins, themes or in the WordPress core and “PHP slow logs” for slow loading scripts (e.g. plugins where scripts exceed 30 seconds to execute), access logs (to see if there’s a DDoS attack or high visitors in general), and load on the server resources, including CPU, RAM, etc.

    The team also checks if WAF is enabled, caching is ON, and any non-used profiling software is turned off when not needed, and will perform conflict tests for plugins and themes and run query monitoring scans at the mysql level when required.

    We also offer integration with New Relic and Blackfire to profile the site and its pages for all sites, large and small.

    Managing Larger WordPress Sites Is A Big Job

    A large WordPress site differs from other WordPress sites mostly in the scale and complexity of its management.

    Dealing with performance issues in large, complex WordPress sites requires having the skills and the expertise to handle challenges and meet the high expectations of enterprise clients.

    Finding information on WordPress enterprise development can be challenging, but focusing on different areas like studying the WordPress Core, APIs, and the surrounding ecosystem, practicing in the main technical areas, and following leading agencies, will help you become more knowledgeable and confident in your abilities as a developer.

    Also, managing a large WordPress database can be challenging but there are solutions available to help you manage it. By optimizing your database, using caching and CDN services, using a managed WordPress hosting service, and regularly backing up your database, you can ensure that your website runs smoothly and avoid potential issues.

    By addressing common performance challenges and regularly monitoring your site’s performance to identify and address any issues as they arise, you can significantly improve the performance of your larger WordPress site.

    Finally, hosting your site on enterprise-level servers with an experienced and reliable managed WordPress hosting partner like WPMU DEV will not only improve your large site’s performance but also help to eliminate problems and issues, as your site will be expertly managed and monitored 24/7.

    If you are looking to migrate your existing site from another host or upgrade hosting for a large WordPress site, we recommend looking at our enterprise-level hosting plans (3 x Essential and 3 x Premium options), and taking advantage of our hosting buyout and free expert site migration service.

    ***

    Ask Charly Leethan

    Special thanks to WPMU DEV member Charly Leethan for her contribution to this post. AskCharlyLeethan provides ongoing support and advice to help small businesses define and refine their processes and plan and build their web presence using current and emerging technologies.

    Go to source

  • How to Stop WordPress From Overwriting .htaccess File

    Recently one of our readers asked if it was possible to stop WordPress from overwriting the custom code in your .htaccess file?

    WordPress along with several plugins add custom settings to the .htaccess configuration file. If you have added your own custom code to .htaccess, then you may be worried that it will be overwritten or deleted.

    In this article, we’ll show you how to stop WordPress from overwriting the .htaccess file.

    How to Stop WordPress From Overwriting .htaccess File

    Why Does WordPress Overwrite the .htaccess File?

    Your .htaccess file is a powerful configuration file that stores important settings about your WordPress website. It contains rules that tell your hosting server how to handle your site.

    WordPress uses the .htaccess file to store its permalink settings. Whenever you change or regenerate your permalinks, WordPress will automatically overwrite the old settings in .htaccess with the new settings.

    Some WordPress plugins also save their settings in .htaccess. For example, the W3 Total Cache plugin will modify your .htaccess file in order to configure the caching and optimization tools that are part of the plugin.

    Lastly, you can make your own custom changes to .htacess to control how your website works. For example, you can add custom rules to the file that protect your admin area, keep your site safe from hackers, set up redirects, ban suspicious IP addresses, and more.

    Some users are concerned that if they add their own custom rules to .htaccess, then they may be deleted when WordPress overwrites the file with new settings. Other users prefer to manually configure .htaccess and not let WordPress write to it at all.

    With that being said, let’s take a look at how to stop WordPress from overwriting your .htaccess file. Simply use the quick links below to jump to the section you are interested in.

    How to Stop WordPress From Overwriting Your .htaccess Rules

    The good news is that if you understand how the .htaccess file works, then you can be confident that your custom rules will not be overwritten.

    That’s because the areas of the file that will be changed by WordPress or your plugins are clearly marked. Simply make sure that you don’t add code to those areas.

    Don’t Modify Code Inside the WordPress Markers

    As we said earlier, WordPress uses .htaccess to store the settings for an SEO-friendly URL structure. The code it saves to the file will be automatically overwritten and updated whenever you change your permalink settings.

    As you can see in the screenshot below, WordPress saves this information between two markers, # BEGIN WordPress and # END WordPress.

    WordPress Markers in .htaccess

    Notice the warning inside those markers:

    The directives (lines) between “BEGIN WordPress” and “END WordPress” are dynamically generated, and should only be modified via WordPress filters. Any changes to the directives between these markers will be overwritten.

    This means that WordPress will not overwrite or modify any code that you add outside these markers. Users typically add their custom code to the top of the file, above the # BEGIN WordPress marker.

    Tip: .htaccess is a hidden file located in your WordPress site’s root folder. If you are having difficulties finding it, then take a look at our guide on why you can’t find the .htaccess file on your WordPress site.

    Don’t Modify Code Inside Your Plugins’ Markers

    When a plugin saves its settings to .htaccess, it also places it between markers that look like # BEGIN Plugin and # END Plugin.

    For example, if you install and set up the W3 Total Cache plugin to improve your website speed and performance, then it will add rules to .htaccess between # BEGIN W3TC Browser Cache and # END W3TC Browser Cache markers.

    Example of Plugin Markers in .htaccess

    These rules will be overwritten whenever you change the plugin’s settings, so you need to be careful not to add your own custom .htaccess rules between those markers.

    Creating Markers for Your Custom Code

    In rare cases, a badly behaved plugin may modify code outside of its # BEGIN and # END markers. However, it will normally not modify code found between the markers used by WordPress or other plugins.

    If you are concerned about a badly behaved plugin overwriting your code, then you can add your own markers to the .htaccess file.

    For example, you can type # BEGIN MyCustomCode and # END MyCustomCode markers at the top of the .htaccess file, and then add your own custom rules between those markers.

    You Can Create Your Own Markers in .htaccess for Your Custom Rules

    If you also need to add code to the end of .htaccess, then you can add a different set of markers there. Just be sure to give them different names. For example, you could use ‘MyCustomCodeTop’ and ‘MyCustomCodeBottom’.

    How to Stop WordPress From Modifying .htaccess

    Now that you understand how .htaccess works, you can be confident that your custom code will not be overwritten by WordPress or your plugins.

    However, some developers and advanced users want to stop WordPress from making any changes to .htaccess.

    For example, they may want to create permalinks by typing the settings manually into .htaccess. In this case, they will want to avoid conflicts by stopping WordPress from saving its own permalink settings to the file.

    We don’t recommend this unless you know what you’re doing, because it can lead to unexpected consequences. However, it can be done by changing the file’s permissions or using code.

    Stopping WordPress From Changing .htaccess Using File Permissions

    One way to stop WordPress from modifying .htaccess is to make the file read-only. To do this, you need to change the file permissions using an FTP client or the file manager provided by your WordPress hosting provider.

    You will find the .htaccess file in the root directory of your WordPress installation. Next, you should right-click the file and select ‘File permissions’.

    Selecting File Permissions From the Menu in Your FTP Client

    This will display a pop-up where you can change the file’s attributes.

    The default setting will be 644, but you can change this to 444 by typing directly into the ‘Numeric value’ field or making sure that only the ‘Read’ boxes are checked.

    Changing the .htaccess File Permissions to 444 or Read-Only

    Once you click the ‘OK’ button, the file will be read-only and cannot be modified.

    Of course, this will mean that you are unable to write to the file as well. When you wish to make changes, you will need to temporarily set the file permissions back to 644.

    Stopping WordPress From Changing .htaccess Using Code

    Another solution is to use a code snippet that lets WordPress know not to write to the .htaccess file. This is useful if you want to stop WordPress from modifying .htaccess without blocking your plugins.

    Note: Editing any core WordPress files can be dangerous. Even a small mistake can cause major errors on your site. That’s why we only recommend this method for advanced users.

    Simply add the following code snippet at the end of your wp-config.php file. If you need help, then please refer to our guide on how to edit the wp-config.php file in WordPress.

    add_filter('got_rewrite', '__return_false');
    

    Once you’ve done that, WordPress will no longer write to the .htaccess file.

    Error Message Displayed When WordPress Can’t Change .htaccess

    If you try to change your permalink settings when .htaccess is set to read-only, then an error message will be displayed.

    At the top of the Settings » Permalinks page, you will see the message ‘You should update your .htaccess file now.’

    Permalink Settings Error Message When .htaccess Cannot Be Accessed

    This lets you know that WordPress was unable to modify the .htaccess file.

    Normally, this is what you intended. However, if you do wish to add the WordPress permalink settings to .htaccess, then you will need to do it manually.

    At the bottom of the Settings ≫ Permalinks page, you will see another error message saying that your .htaccess file is not writable. Underneath that, you will see the rules that need to be added to .htaccess.

    List of Rules You Will Need to Add to .htaccess Manually if Needed

    If you wish to add those settings, then you will need to temporarily change the .htaccess file permissions back to 644 so that it can be edited. After that, you should paste the rules between the file’s WordPress BEGIN and END markers, replacing the code already there.

    When you’re finished, simply set the value back to 444 and save the file. It will once again be unwritable.

    We hope this tutorial helped you learn how to stop WordPress from overwriting the .htaccess file. You may also want to learn how to add push notification in WordPress and check out our expert list of the best WordPress SEO plugins and tools.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Stop WordPress From Overwriting .htaccess File first appeared on WPBeginner.

    Go to source

  • How to Open a WordPress Popup Form On Click of Link or Image

    Do you want to create a popup that appears when visitors click on a link or an image on your site?

    This is a proven way to grow your email list. It is more effective since it starts with an action taken by a user. Popular sites often use it to offer an optin incentive to get even more subscribers.

    In this article, we’ll show how to open a WordPress popup on click of a link or an image, step by step.

    How to Open a WordPress Popup Form on Click of Link or Image

    What Is an ‘On Click’ Popup Form?

    On-click popup forms are lightbox popups that open when a user clicks on a link, button, or image on your WordPress website.

    Normally, popups appear on websites when a user arrives or when they are about to leave. On-click popup forms are triggered by user interaction.

    We also use on-click popups on WPBeginner to grow our email list. For instance, a popup will appear when a user clicks the email icon in the sidebar next to all social icons.

    On click popup preview

    Why Are On-Click Popup Forms So Effective?

    On-click popup form is effective because it uses the powerful Zeigarnik effect. This is a psychological principle that states users who start an action themselves are more likely to finish it.

    When someone clicks a link or button to trigger your popup, they’ve already shown interest. When the form popup appears, they’ll be more likely to use it.

    For example, you can use an on-click popup to offer a lead magnet. This could be a free downloadable resource like an ebook or PDF file that users can get in exchange for their email address.

    However, there are other ways to use on-click popups on your website. For instance, you can ask users to claim a coupon code, learn more about a product, fill-out surveys, and more.

    That being said, let’s take a look at how to easily make an on-click lightbox popup for your website.

    Creating an On-Click Popup in WordPress

    The easiest way to create an on-click popup is by using OptinMonster. It is the popup plugin for WordPress and lead generation software.

    First, you’ll need to sign up for an OptinMonster account. You’ll need the Pro account (or higher) because it includes the MonsterLinks™ feature that lets you create on-click popups.

    Simply visit the OptinMonster website and click the ‘Get OptinMonster Now’ button to get started.

    OptinMonster

    Next, you need to install and activate the OptinMonster plugin on your WordPress website. For help, see our step-by-step guide on how to install a WordPress plugin.

    This lets you connect your OptinMonster account to your WordPress site.

    Once you’ve activated the plugin, you’ll need to connect your account. You should be taken to the Welcome page automatically in your WordPress dashboard.

    Go ahead and click the ‘Connect Your Existing Account’ button.

    Connect your existing account

    After that, a new window will open.

    You can click the ‘Connect to WordPress’ button to add your site to OptinMonster.

    Connect OptinMonster to WordPress

    Once you’ve connected your OptinMonster account to your WordPress site, you can create your on-click popup.

    Simply go to OptinMonster » Campaigns from your WordPress dashboard and click the ‘Create Your First Campaign’ button.

    Create your first campaign

    You’ll be taken straight to the OptinMonster website.

    The Campaign Type should already be set to Popup. If not, just click on Popup to select it. Next, you’ll need to choose a campaign template.

    Choose a campaign type and template

    You’ll be able to modify the template exactly how this looks later. We’re going to use the ‘Basic’ template for this tutorial.

    Simply run your cursor over the template and click the ‘Use Template’ button.

    Select the basic template

    Now, you’ll be prompted to enter a name for your campaign. This is just for you. The users will not see it.

    Simply enter a name and click the ‘Start Building’ to create your popup.

    Enter a name for your campaign

    OptinMonster will automatically load up the template in the drag-and-drop campaign builder.

    You can edit the default text and add or remove elements from your template. Simply drag blocks from the menu on your left and drop them on the template.

    Add blocks to onclick campaign

    You can also remove any element in the form by clicking on it and using the menu options to the left. For instance, we will remove the ‘Name’ field from the form.

    First, you’ll need to click on the ‘Optin’ tab at the bottom of the screen. After that, click on the field to select it, and you’ll see the available options in the left column, including the option to remove it.

    Delete name field

    Once you have designed the popup, the next step is to design the Success view, which people see after filling out the form.

    Simply switch to the ‘Success’ view at the top of the screen.

    Edit the success view for onclick popup

    You can edit the success view just like you edited the optin view. For instance, you may want to change the text or include a link to download a lead magnet.

    Connecting Your Popup to Your Email List

    Once you’re happy with your popup, click on the Integrations tab at the top of the screen. You’ll need to link OptinMonster to your email marketing service so that you can add people to your email list.

    From here, click the ‘+ Add New Integration’ button on the left-hand side of the screen.

    Add an email marketing tool

    Next, you can select your email provider from the dropdown list.

    From here, simply follow the instructions to connect it to OptinMonster.

    Select your email provider

    Setting Your Popup to Appear On Click

    Now, you need to configure your popup to appear when the user clicks a link.

    Go ahead and click on the Display Rules tab at the top of the screen.

    Select display rules

    The default display rule set by OptinMonster is ‘time on page.’ This means that the default pop-up will appear after the user has been looking at that page for a certain amount of time.

    However, you can click the dropdown and select the ‘MonsterLink™’ (On Click)’ option instead.

    Select MonsterLink display rule

    After that, you should see your MonsterLink™ in the display rules.

    You can click the button to copy your MonsterLink™ Code. You’ll need this in a moment.

    Copy the MonsterLink

    Making Your On-Click Popup Live

    Next, you can go to the ‘Published’ tab at the top of the page and change your campaign’s status from ‘Draft’ to ‘Publish.’

    Publish your on click campaign

    Once you’ve done that, click the ‘Save’ button at the top of the screen and close the campaign builder.

    Next, you’ll see the ‘WordPress Output Settings’ for your campaign. You can click the ‘Status’ dropdown menu and change it from ‘Pending’ to ‘Published.’ When that’s done, click the ‘Save Changes’ button.

    Change status from pending to published

    Adding Your MonsterLink to Your WordPress Website

    Now, you need to add the special MonsterLink™ to your site. If you didn’t copy this earlier, you can get it by going back to the ‘Display Rules’ setting for your campaign.

    First, you’ll need to create a new post or page, or edit the one where you want to add your link.

    The MonsterLink™ is HTML code, so you need to paste it into a custom HTML block.

    When you’re in the WordPress content editor, click the (+) button to add a Custom HTML block.

    Add a Custom HTML Block to Your Page

    Now, copy your MonsterLink™ into that block. It should look something like this:

    <a href="https://app.monstercampaigns.com/c/mcqdabfqzia6zdiosiz0/" target="_blank" rel="noopener noreferrer">Subscribe Now!</a>
    

    You can change the words ‘Subscribe Now!’ to whatever text you want to use for your link.

    Enter the MonsterLink Code

    Once you’ve placed the link, you can preview your page or post to ensure it’s working.

    Here’s our link in action. Note we’ve applied some styling to the text to create a box with larger text to help promote the lead magnet:

    On click popup preview

    Tip: You’re not limited to just text links using MonsterLinks™. You can also use MonsterLink with call-to-action buttons, images, banners, or navigation menus on your website.

    We hope this tutorial helped you learn how to trigger a WordPress popup form on click. You may also want to see our tutorial on how to speed up your WordPress site and our ultimate WordPress SEO guide.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Open a WordPress Popup Form On Click of Link or Image first appeared on WPBeginner.

    Go to source

  • How to Enable / Activate WordPress Plugins from the Database

    Are you looking to enable or activate plugins from the WordPress database?

    If you are unable to access your WordPress admin area and need to activate a plugin to restore your access, then you can do that from the WordPress database.

    In this article, we will show you how to easily activate your WordPress plugins using the database.

    How to enable/activate WordPress plugins from the database

    When Should You Activate WordPress Plugins Using Database

    A number of common WordPress errors can prevent a website owner from accessing the WordPress admin area. In most of those situations, the user is looking to deactivate WordPress plugins without admin access.

    However in some situations, a website owner may need to activate certain plugins to restore access to their WordPress website.

    For example, let’s assume an error is stopping you from accessing your WordPress dashboard, and you have found a plugin that can fix that error.

    Luckily, WordPress stores the active plugins information in your WordPress database. This means you can manually enter this information directly in the database and tell WordPress to activate a plugin.

    The only condition is that the plugin must be installed on your WordPress site. Which means that it should be present in the plugins folder on your WordPress website.

    With that being said, let’s see how you can easily enable/activate a plugin using the database.

    Step 1. Find Your Database Name Using the Hosting Control Panel

    To activate your WordPress plugins using phpMyAdmin, first, you need to find out your WordPress database’s name.

    Now, to find the name of your database, you need to log in to your web hosting dashboard. For this tutorial, we will be using Bluehost.

    If you are using a different hosting company, then your WordPress hosting dashboard may look slightly different.

    Once you are on the cPanel, scroll down to the ‘Files’ section and click the ‘File Manager’ option.

    Click at the file manager

    This will open up the File Manager in a new window. Here you simply need to locate and click the public_html folder from the left column.

    This will open up all the files that are stored in the public_html folder. Now, you simply need to locate and click the folder with your site’s name on it present under the ‘Name’ column.

    Go to the publich_html file and find your site name

    Some users may instead see their WordPress files and folders installed inside public_html folder.

    After you have opened up your WordPress site’s file, locate the wp-config.php file under the ‘Name’ section and right-click on it.

    This will open up a menu where you need to select the ‘View’ option.

    Click View

    This will open up the wp-config.php file in a new window where you can locate your database details.

    We recommend that you copy and paste your database details including username and password into a notepad on your computer.

    Database details

    Now you’ve successfully found your database’s name, let’s move to our next step.

    Step 2. Locate Active Plugins Option via PhpMyAdmin

    After you have found out the name of your database, you need to go back to your WordPress hosting control panel.

    Once there, scroll down to the ‘Databases’ section and click the ‘phpMyAdmin’ option.

    Click the phpMyAdmin option in the cPanel

    This will launch the phpMyAdmin app in a new browser tab.

    Note: Before you make any kind of changes, please make sure to create a complete backup of your database. It will come in handy if anything goes wrong with the process.

    Next, you simply need to click the ‘Database’ tab from the navigation menu present at the top of the page.

    Now, simply locate your WordPress database and click on the browse button to expand it.

    Click the Database tab from the navigation menu

    This will show your WordPress database tables.

    Here, you will simply need to locate wp_options table and click browse next to it.

    Note: By default, WordPress uses wp_ as the prefix for table names. Your WordPress database table may have a different table prefix.

    Click at wp-options

    Inside the wp_options table, you’ll need to find the row where option_name is set toactive_plugins.

    After that, click on the Edit link next to it.

    Click the Activate_Plugins option

    This will open up a box where you can manually enter details to activate a plugin.

    Step 3. Activate a Plugin Using phpMyAdmin

    WordPress stores the active plugins information in a special format so that it can be programatically accessed by the software.

    In order to tell WordPress which plugins to activate, we’ll need to use that same format.

    First, we’ll start by entering the option_value as a:1: and then open up the curly bracket ({).

    We are entering this value as 1 because we only want to activate one plugin. You have to change the value to the number of plugins you plan on activating.

    Add option value

    Next, we will be entering i:0; after the curly bracket. Here we are essentially assigning a serial number to our plugin.

    Remember to always assign numbers starting from 0 instead of 1.

    Add serial number

    Next, we will be entering the number of characters present in the plugin’s name and the php file name of the plugin that we’re about to activate.

    For that, we will type s:24: in the box. Keep in mind that the number of characters will differ for each plugin based on the characters in the plugin directory and file name.

    For instance, we are activating WPForms in this tutorial which has 24 characters in its name including the file name of the plugin as stored in our file manager.

    Add character number

    Next, you just need to type the plugin’s directory name. You can find it by visiting the /wp-content/plugins/ folder using the File Manager app.

    Don’t forget to add quotation marks before typing the plugin’s directory name.

    Type the plugins' name

    After the /, you need to enter the plugin’s file name. This is usually the file with similar name inside the plugin folder.

    Plugin file and folder name

    Now, go back to phpMyAdmin and type the name of the plugin and then close the quotation marks.

    After that, simply add a semi-colon (;) and close the curly brackets (}). The final value in this example would look like this:

    a:1:{i:0;s:24:"wpforms-lite/wpforms.php";}
    

    This is how it will look once you’re done.

    Activating a single plugin

    Next, simply click the ‘Go’ button to execute the command.

    Now go visit your WordPress dashboard and head over to Plugins » Installed Plugins.

    Your plugin has been successfully activated.

    activated-plugin

    Now let’s say you want to activate two more plugins.

    First you will need to change the number of plugins. After you will adjust each entry for the plugin that you want to activate.

    Here is an example:

    a:3:{
    i:0;s:47:"all-in-one-seo-pack-pro/all_in_one_seo_pack.php";
    i:1;s:35:"insert-headers-and-footers/ihaf.php";
    i:2;s:24:"wpforms-lite/wpforms.php";
    }
    

    Note: We have added line breaks here to make the code look more readable. You need to make sure that there are no line breaks or spaces in your code. Otherwise, it wouldn’t work.

    We hope you learned how to activate a plugin using the database. You may also want to see our guide on how to add social media feeds to WordPress, and our comparison of the best domain registrars in the world.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Enable / Activate WordPress Plugins from the Database first appeared on WPBeginner.

    Go to source

  • How to Fix the Facebook and Instagram oEmbed Issue in WordPress

    Do you want to learn how to fix the Facebook and Instagram oEmbed issue in WordPress?

    If you’ve previously added Facebook or Instagram content to WordPress using the default oEmbed or Embed block, then this feature no longer works. This can cause errors and missing content on your WordPress website.

    In this guide, we’ll show you how to fix the Facebook and Instagram embed issue, so visitors can enjoy social content on your WordPress website.

    How to fix the Facebook and Instagram oEmbed issue in WordPress

    What is the Facebook and Instagram oEmbed Issue in WordPress?

    In the past, you could easily embed Instagram and Facebook posts in WordPress using a protocol known as oEmbed.

    However, Facebook changed the way that oEmbed works so you can no longer easily embed videos, pictures, updates, and other content from Facebook or Instagram.

    Instead, you now need to register an app and use a client token to get data from the Facebook Graph API, before you can embed Facebook or Instagram content on your WordPress blog.

    This would take a lot of time and effort, especially if you want to show lots of different social posts across your website. With that in mind, the people behind WordPress decided to remove the Facebook and Instagram embed feature.

    If you previously added any Facebook content to your website using oEmbed, it’ll now look something like the following image.

    An example of an oEmbed error in WordPress

    If you embedded any Instagram posts using oEmbed, then you’ll get a similar error.

    This is a bad user experience, and some visitors may assume that your website is broken, no longer maintained, or that you’re not a trustworthy or reliable business.

    There are ways to fix the problem manually. For example, you might go through each page and post and delete the embedded content. However, this would take a lot of time and effort, and there’s no guarantee you’ll manage to find every broken embed.

    With that being said, let’s see how you can easily fix the Facebook and Instagram oEmbed issue on WordPress.

    How to Fix the Facebook & Instagram oEmbed Issue

    The easiest way to fix the oEmbed issue is by using one of the free Smash Balloon plugins.

    If you want to embed Instagram posts in WordPress, then you’ll need the Smash Balloon Social Photo Feed plugin.

    An instagram post, embedded in a WordPress website

    Want to embed a Facebook post in WordPress? Then you can use the free Smash Balloon Social Post Feed plugin instead.

    First, you need to install and activate the plugin. For more details, see our step by step guide on how to install a WordPress plugin.

    After installing either plugin, simply head over to Instagram Feed » oEmbeds or Facebook Feed » oEmbeds, depending on the plugin you’re using.

    We’re using the Social Photo Feed plugin in all our images, but the steps will be exactly the same no matter what plugin you’re using.

    Enabling the oEmbed feature for Instagram and Facebook

    On this screen, simply click on the ‘Enable’ button.

    That’s it. You can now embed Facebook and Instagram posts on your WordPress website.

    How to Embed Instagram or Facebook Posts in WordPress

    Whether you’re using Facebook or Instagram, you can embed a specific post in any page, post, or widget-ready area, such as the sidebar.

    One option is to open the page or post where you want to show the social content. Then, click on the ‘+’ icon and type in ‘Embed.’

    When the right block appears, click to add it to the page or post.

    Adding the Embed block to a WordPress page or post

    In the ‘Embed’ field, simply paste the URL of the Instagram or Facebook post that you want to show on your website.

    Then, click on ‘Embed.’

    Embedding an Instagram post in WordPress

    WordPress will now show that specific post. When you’re ready to make the post live, simply click on ‘Update’ or ‘Publish.’

    Now when you visit the page, you’ll see the social media post live.

    An example of an Instagram post in WordPress

    Another option is adding the Instagram or Facebook post to a widget-ready area such as the sidebar. That way, you can promote the same post across every page of your website.

    For example, you might embed your most popular Instagram post or a post promoting a sale or social media contest you’re using to grow your site.

    Adding an Instagram post to a widget-ready area such as the WordPress sidebar

    To add a Facebook or Instagram post to a widget-ready area, simply go to Appearance » Widgets and click on the blue ‘+’ button.

    In the search bar, type in ‘Embed’ to find the right block.

    Embedding an Embed block in WordPress

    When the ‘Embed’ block appears, drag it onto the area where you want to show the Facebook or Instagram post.

    In the ‘Embed’ field, simply paste the URL of the Instagram or Facebook post that you want to show on your website. Then, click on ‘Embed.’

    Embedding Instagram photo in Instagram

    WordPress will now show that specific post.

    If you’re happy with how it looks, then click on ‘Update’ to make it live.

    Embedding Instagram post in WordPress

    Now, when you visit your website, you’ll see the Instagram or Facebook post live.

    How to Add an Instagram or Facebook Feed to WordPress

    With the free Smash Balloon plugins, it’s easy to fix the oEmbed issue so you can add Facebook and Instagram posts to your website.

    This is great if you only want to embed a small number of posts or you want to control exactly where each social post appears on WordPress. However, you may also want to embed a Facebook or Instagram feed on your website.

    By creating a feed, you can show all your latest posts in a nice layout. Even better, the feed will update automatically so visitors will always see the newest posts without you having to update your site manually.

    This can keep your site fresh and interesting, even for regular visitors.

    If you want to embed Instagram content in WordPress, then you can use the Smash Balloon Instagram Feed plugin.

    An Instagram feed, created using Smash Balloon

    Want to create a feed showing your latest Facebook status posts, videos, reviews, and more?

    Then you can use the Smash Balloon Facebook Feed plugin.

    Facebook reviews, embedded using Smash Balloon

    Want to add both Facebook and Instagram feeds to your WordPress website? Then you may want to look at Smash Balloon Social Wall.

    This powerful plugin lets you combine any feeds you’ve created using the Smash Balloon plugins, including Facebook, Twitter, YouTube feeds, and more.

    Creating a social media wall using Facebook and Instagram

    For example, if you’ve set up the Facebook Feed and Instagram Feed plugins, then you can simply go to Social Feeds » Create a Social Wall in your WordPress dashboard.

    Here, you’ll see all the different feeds you’ve created so far.

    How to create a social media wall using multiple feeds

    Simply select each feed that you want to add to the social wall.

    For example, you can combine posts from your Instagram and Facebook accounts.

    Combining Facebook and Instagram into a social wall

    Small Balloon Social Wall will then create a shortcode that allows you to add the social wall to any page, post, or widget-ready area.

    For more information about working with shortcodes, please see our guide on how to add a shortcode in WordPress.

    Social media shortcode, created using the Smash Balloon plugin

    After placing the shortcode, simply save or publish your changes to make them live.

    Now, if you visit your website, you’ll see a social wall featuring all the latest posts from your different accounts and platforms.

    We hope this article helped you learn how to fix the Facebook and Instagram oEmbed issue in WordPress. You may also want to see our expert pick of the best social media plugins for WordPress, and our guide on how to create an email newsletter.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Fix the Facebook and Instagram oEmbed Issue in WordPress first appeared on WPBeginner.

    Go to source

  • How to Start WooCommerce Multi-Vendor Store Using Dokan

    Multi-vendor online stores also known as multi-vendor marketplaces are becoming popular nowadays. The idea behind a multi-vendor store is to allow individuals, resellers and/or companies to create their profiles and sell products.

    The post “How to Start WooCommerce Multi-Vendor Store Using Dokan” first appeared on WP Mayor.

    Go to source

  • How to Properly Disable Lazy Load in WordPress (Step by Step)

    Do you want to disable lazy loading in WordPress?

    By default, WordPress comes with a lazy load feature, which delays downloads for images and other media to improve page load speed.

    However, for some websites, it may affect user experience by not displaying images and media right away.

    In this article, we’ll show you how to easily disable lazy load in WordPress both using a code method as well as a plugin method.

    How to properly disable lazy load in WordPress

    What is Lazy Loading?

    WordPress first introduced lazy loading images in WordPress 5.5. Later it extended the lazy load feature to iframes embeds (e.g. YouTube videos, Spotify, and other embeds).

    This practice helps improve your website’s speed and performance by quickly loading content and the visible area first.

    A faster website is not just good for users, but it is also good for SEO. Search engines like Google consider speed as an important ranking factor.

    Apart from images and embeds, you can also easily lazy load comments and Gravatars to further improve page load speed.

    Lazy loading can be seen in action by right-clicking on an image and selecting the Inspect tool in your browser.

    Lazy loading images in WordPress

    This will split your browser screen and show you the HTML source code. From here, you’ll be able to see the “loading=lazy” attribute added to the image.

    Now normally, we don’t recommend disabling lazy load due to its overall benefits for your WordPress website. Turning it off can result in slower website speed, lower conversion rates, and lower SEO rankings.

    However, sometimes lazy loading can affect the user experience for some websites.

    For instance, if you run a photography website where images are the most significant aspect of your content, then lazy loading them may ruin the user experience for your customers.

    In other cases, you might be using a different lazy loading solution and just want to turn off the default WordPress lazy load.

    That being said, let’s see how you can easily disable lazy load in WordPress.

    You can simply disable the lazy load feature in WordPress by adding a custom code snippet to your theme’s functions.php file.

    However, keep in mind that the smallest error while adding the code can result in breaking your website and making it inaccessible to your users.

    This is why we recommend using the WPCode plugin to add custom code to your site.

    It is the best custom code snippets plugin that makes it super easy for beginners to safely add custom code to their website.

    First, you need to install and activate the WPCode plugin. See our guide on how to install a WordPress plugin for more instructions.

    Upon activation, go to the Code Snippets » + Add Snippet page.

    Add new snippet

    This will take you to the ‘Add Snippets’ screen where you’ll see a bunch of ready-to-use code snippets that you can add to your website.

    From here, you need to click the ‘Use Snippet’ button under the ‘Add Your Custom Code (New Snippet)’ option.

    Once you’re on the ‘Create Custom Snippet’ page, you can start by typing a name for your code snippet.

    It can be anything that will help you identify the code snippet and what it does.

    Snippet title and type

    After that, select ‘PHP Snippet’ from the dropdown menu next to the ‘Code Type’ option.

    Now, copy and paste the following PHP code in the ‘Code Preview’ box.

    add_filter( 'wp_lazy_loading_enabled', '__return_false' );
    

    This is how the code will look after it is pasted in the ‘Code Preview’ box.

    Add code snippet

    After adding the code, scroll down to the ‘Insertion’ section.

    Here, simply choose ‘Auto Insert’ as the insertion mode. This will ensure that your custom code is automatically executed everywhere on your website once you activate the snippet.

    Choose an insertion method

    Next, you need to scroll to the top of the page and simply toggle the ‘Inactive’ switch to ‘Active’.

    After that, don’t forget to click the ‘Save Snippet’ button to save and execute your custom snippet.

    Save your code snippet

    Once activated, this custom code snippet will disable the lazy loading feature on your WordPress website.

    You can test by right-clicking on an image and selecting Inspect from the browser menu.

    In the HTML code for the image, the loading=lazy attribute will now disappear.

    Lazy loading disabled

    Method 2. Disable Lazy Load in WordPress Using a Plugin

    If you don’t want to add code to your site, then you can use the Disable Lazy Load plugin.

    The only thing you need to do is install and activate the Disable Lazy Load plugin. For more instructions, check our guide on how to install a WordPress plugin.

    Activate plugin to disable lazy load

    The plugin works out of the box and does not require any configuration. Once activated, it will automatically disable the lazy load feature on your site.

    We hope this article helped you learn how to properly disable lazy load in WordPress. You may also want to see our guide on how to optimize WordPress images for better page load times, or see our pick of the best WordPress image compression plugins.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Properly Disable Lazy Load in WordPress (Step by Step) first appeared on WPBeginner.

    Go to source

  • How to Fix DNS Server Not Responding Error in WordPress (5 Ways)

    Are you looking for the easiest way to fix the ‘DNS server not responding’ error in WordPress?

    You can get the DNS not responding error on your own WordPress website, or third-party sites for a large number of reasons.

    In this article, we’ll show you how to easily troubleshoot and fix the ‘DNS server not responding’ error in WordPress.

    How to fix the DNS server not responding error in WordPress

    What is the ‘DNS Server Not Responding’ Error in WordPress?

    The ‘DNS server not responding’ error is one of the most common WordPress errors that users can come across.

    This error prevents you from visiting your own website which makes it difficult to troubleshoot. Many beginners aren’t sure if it is just them or everyone else seeing this error.

    Preview of the DNS server not responding error

    The ‘DNS server not responding’ error means that your browser was unable to establish a connection with the servers that are hosting the website.

    This error usually occurs when there is an unavailable DNS provider, firewall issues, network connectivity problems, or when there is an issue in your internet modem or router.

    That being said, let’s take a look at multiple ways to easily troubleshoot and fix the ‘DNS server not responding’ error on your website.

    1. Check Your Internet Connection

    You might get the ‘DNS server not responding’ error because your internet connection has been disconnected. So to start, you need to make sure that you’re currently connected to the internet.

    If your internet is connected, but the error is still present, then you can restart your internet connection by switching your computer on and off.

    Or you can simply disconnect your router from its power supply and then wait at least a minute before reconnecting it.

    After that, try visiting your WordPress blog to see if the error’s gone.

    2. Try Switching to Another Web Browser or Incognito Mode

    Sometimes this error occurs because there is an issue in your default web browser.

    You can simply try to solve the ‘DNS server not responding’ error by visiting your WordPress site using another browser like Mozilla Firefox or Microsoft Edge.

    For example, if you use Google Chrome and the browser is showing the ‘DNS server not responding’ error, try accessing your website using Mozilla Firefox.

    You could also try opening the page in a private tab, such as using Chrome’s Incognito mode.

    If you are able to access the website in the other browser that means the problem is with your default web browser.

    In that case, you can clear the browser cache to see if that fixes the issue. If that doesn’t solve the problem, then you can try reinstalling the browser.

    3. Disable Your Firewall or Antivirus

    Firewall and Antivirus programs protect your computer from malicious software.

    However, sometimes these programs can also block trustworthy sites due to strict settings or an issue within the program itself.

    To check if you’re getting the ‘DNS server not responding’ error due to these software, you need to temporarily deactivate your firewall and antivirus programs.

    If you’re using Windows, then you can easily disable firewall and antivirus programs by selecting the Settings app from the Start menu.

    Go to Settings from the Start menu

    Once you’re on the ‘Settings’ app, click the ‘Privacy and Security’ option from the sidebar.

    Now simply choose the ‘Windows Security’ option in the ‘Privacy and Security’ tab.

    Go to Privacy and Security and select Windows Security

    On the ‘Windows Security’ page, you need to select the ‘Virus and Threat Protection’ option from the list.

    After that, you need to toggle the switch below the ‘Microsoft Defender Firewall’ option and set it to Off.

    Switch the firewall toggle off

    If you’re using a Mac, then simply go to System Preferences » Security and Privacy from the Apple toolbar.

    This will take you to the ‘Security and Privacy’ window.

    Go to System Preferences and select Privacy and Security

    Here simply click the ‘Firewall’ tab and then turn off the firewall.

    You have now disabled the antivirus and firewall programs.

    Turn off Firewall in Mac

    After disabling the firewall, visit your site to see if the error has been resolved.

    4. Change the DNS Server Address

    Sometimes the ‘DNS server not responding’ error is caused when the DNS server assigned to you by your internet service provider is unavailable or has incorrect information.

    In that case, you can solve the problem by switching to a different public DNS server, such as Cloudflare or Google Public DNS which offer DNS address for free.

    If you use Windows, go to the Windows Search Box from the taskbar and type ‘ncpa.cpl‘ to access the Network Connections page.

    Go to ncpa.cpl for network connections

    Once you’re on the ‘Network Connections’ page, right-click on the internet connection that you’re currently using.

    Next, simply select the ‘Properties’ option from the prompt that opens up.

    At this point, you may need to provide an administrator password. If you don’t have those permissions, contact your IT department or computer admin.

    Select the Properties option after right clicking

    After that, you will see the ‘Properties’ window.

    Here you have to locate and double-click the ‘Internet Protocol Version 4 (TCP/IPv4)’ option from the list which will open up a new window.

    Double click the Internet Protocol Version option

    Once here, simply check the ‘Obtain an IP address automatically’ box and then check the ‘Use the following DNS server addresses’ box.

    After that, you need to type the DNS address you obtained from the public DNS servers and click the ‘OK’ button at the bottom.

    For example: Cloudflare public DNS is 1.1.1.1 vs Google public DNS is 8.8.8.8 and 8.8.4.4.

    Type your preferred DNS

    Now restart your computer and visit your site to see if the error is resolved.

    If you’re a Mac user, simply select the Apple icon in the toolbar and click the ‘System Preferences option.

    Go to System Preferences

    In the popup that appears, select ‘Network’ and then click on the ‘Advanced’ button.

    After that, simply open the ‘DNS’ tab. Here you will find a ‘+’ button at the bottom-left corner.

    Choose DNS option and click the + button

    Clicking it will add a new DNS server with the address 0.0.0.0.

    Now go ahead and type the numbers for the public DNS server you want to use.

    For example: Cloudflare public DNS is 1.1.1.1 vs Google public DNS is 8.8.8.8 and 8.8.4.4.

    Write your DNS

    After that, simply click on the ‘OK’ button which will take you back to the previous popup.

    Here, simply click the ‘Apply’ button to save your changes.

    Apply DNS change

    Now, you need to visit your site to check if the error has been removed.

    5. Flush Your DNS Cache

    Just like your browser, the computer also stores all the IP addresses of the websites that you visit so it won’t have to look up the same IP address twice.

    However, DNS cache information can get outdated which can cause the ‘DNS server not responding’ error on your site.

    This can happen when you have moved your site to a new domain name or when you’ve moved your site to a new WordPress host.

    Flushing your DNS cache can remove the ‘DNS server not responding’ error. All you need to do is check out our guide on how to clear your DNS cache on Mac, Windows, and Google Chrome for more instructions.

    We hope this article helped you learn how to easily fix the ‘DNS server not responding error’ in WordPress. You may also want to check out our ultimate security guide for WordPress and the best email marketing for small businesses.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Fix DNS Server Not Responding Error in WordPress (5 Ways) first appeared on WPBeginner.

    Go to source

  • The Ultimate WordPress Local Development Cheatsheet

    Want to set up a local WordPress development environment without thumbing through pages and pages of documentation? Our WordPress local development cheatsheet will help you get up and running quick smart!

    In this ‘no-fluff’ practical guide, we’ll cover briefly what WordPress local development is and some of the key benefits of using it, and we’ll then get straight into how to set up a local environment, install WordPress on your computer, and test your website before going live.

    This guide covers the following:

    What Is WordPress Local Development?

    WordPress local development allows you to create a development environment for building, working, and testing WordPress sites on your computer without affecting your live site.

    The local development environment replicates the production server, making it possible to test different scenarios and resolve issues before pushing changes to the live site.

    Benefits of Local Development

    Some of the key benefits of WordPress local development include:

    • Safe Testing Environment: The local development environment provides a safe space to test new features, plugins, and themes without affecting your live site.
    • Speed, Performance, and Efficiency: A local development environment is faster and more responsive than a remote server. This is because it runs on your computer, so your computer can access and process data much faster than a server, and there is no latency in communication between your machine and the server.
    • Cost-Effective: Setting up a local development environment eliminates the need for expensive hosting services and reduces the costs associated with deploying changes to a live site. You only need a computer and a text editor to get started.
    • Improved Collaboration: Multiple developers can work on a single project simultaneously without interfering with each other’s work.
    • Offline Development: With a local development environment, you can develop your site even when you’re offline.
    • Improved Security: Got a “top secret” project you want to work on? Since a local development environment runs on your machine, it is more secure than a remote server, so you can build and work on your site away from prying eyes. There is no risk of unauthorized access or hacking.

    If you’re just getting started as a WordPress developer, see our introduction to WordPress local development article. If you’re already a little more experienced, check out our article on ways to improve your WordPress development workflow in a local environment.

    Setting Up Your Local Development Environment

    Before you can set up a local WordPress development environment, there are some things you’ll need.

    What You’ll Need

    In addition to a computer with enough storage space and processing power to support your development work, here’s all you need to set up a local development environment:

    Local Server Software

    You will need to install a local server software to run your local development environment.

    XAMPP, MAMP, and WAMP are three popular options. Each of these local server software packages provide a complete development environment for web developers with all the necessary components (such as Apache web server, MySQL database, and PHP scripting language, in a single package), a control panel to manage these components and a tool to manage the database.

    Each software package, however, also has its own unique features with key differences, so it’s important to choose one that meets your specific needs.

    Let’s take a brief look at each:

    XAMPP

    XAMPP
    XAMPP

    XAMPP is a free, open-source, and easy-to-install web server software that provides a local development environment for web developers. It stands for Apache, MariaDB, PHP, and Perl, the four main components of XAMPP.

    Some key features (and pros) of XAMPP:

    • Includes Apache web server, MariaDB database, and PHP and Perl scripting languages.
    • Supports multiple operating systems, including Windows, Mac, and Linux.
    • Easy-to-use control panel for managing web server and database components.
    • Option to install additional components such as phpMyAdmin for database management.

    Cons:

    • Not as popular as MAMP or WAMP, so the community support may not be as strong.
    • More complex set-up compared to MAMP or WAMP, requiring more technical knowledge to install and configure components.

    XAMPP is best for web developers who require a complete development environment with multiple components and are familiar with configuring and managing these components. It is also best for developers who work on multiple operating systems and need a cross-platform solution.

    MAMP

    MAMP
    MAMP

    MAMP is a local server software that provides a development environment for web developers. It stands for Macintosh, Apache, MySQL, and PHP, the four main components of MAMP.

    Some key features (and pros) of MAMP:

    • Includes Apache web server, MySQL database, and PHP scripting language.
    • Supported by macOS operating system, but can also be used for Windows-based OS.
    • Easy-to-use control panel for managing web server and database components.
    • Option to install additional components such as phpMyAdmin for database management.

    Cons:

    • Can only use PHP scripting language.
    • Fewer components compared to XAMPP, which may limit some developers’ needs.

    MAMP is best for web developers who work on the macOS operating system.

    For more information on using this option, check out our tutorial on how to develop WordPress locally using MAMP.

    WampServer

    WampServer
    WampServer

    WAMP is a local server software that provides a development environment for web developers. It stands for Windows, Apache, MySQL, and PHP, the four main components of WAMP.

    Some key features (and pros) of WAMP:

    • Includes Apache web server, MySQL database, and PHP scripting language.
    • Supports Windows operating system.
    • Easy-to-use control panel for managing web server and database components.
    • Option to install additional components such as phpMyAdmin for database management.

    Cons:

    • Only supports Windows, so developers using macOS or Linux may need to look elsewhere.
    • Fewer components compared to XAMPP, which may limit some developers’ needs.

    WAMP is best for web developers who work on the Windows operating system and who require a complete development environment with basic components.

    For more information about this option, check out our tutorial on how to develop WordPress locally using WAMP.

    While XAMPP, MAMP, and WAMP are all excellent choices for web developers looking for a local development environment, there are other options available, including Local by Flywheel, DesktopServer, and (if you need to work on WordPress locally on more than one machine) even installing and running WordPress from a USB.

    Text Editor

    The other component you’ll need is a text editor for WordPress development specifically designed for working with programming languages such as PHP. A text editor is essential for editing code and making changes to your website.

    Let’s look at a couple of popular options for text editors:

    Sublime Text

    Sublime Text
    Sublime Text

    Sublime Text is a popular text editor that is widely used by developers for coding and scripting purposes. It offers a clean, fast and intuitive interface, making it easy to work with large codebases.

    Some key features of Sublime Text:

    • Syntax highlighting and code completion for over 80 programming languages
    • Customizable color schemes, key bindings, and macros
    • Advanced searching and editing tools such as multiple selections, split editing, and column editing
    • Instantly switch between projects with a project-specific settings system

    Sublime Text is a great tool for developers who work on projects that require writing code in HTML, CSS, and JavaScript. It offers easy-to-use syntax highlighting, code completion, and editing tools that make the coding process fast and efficient.

    Visual Studio Code

    Visual Studio Code
    Visual Studio Code

    Visual Studio Code is a free, open-source code editor developed by Microsoft. It offers a range of features and tools to help developers create and manage large-scale projects.

    Some key features of Visual Studio Code:

    • IntelliSense, a smart and advanced code completion and debugging tool
    • Built-in Git support and debugging
    • Supports multiple programming languages and has a large library of extensions
    • Customizable interface and workspace

    For additional text editors, see our list of the best text editors for WordPress development.

    Have you ticked all of the above requirements?

    Computer meets required specs
    Selected local server software
    Selected text editor

    Great! Then let’s move on to the next step…

    Installing Local Server Software

    For this example, we’ll install XAMPP on a Windows operating system. Use the same process described below to install your chosen local server software on your computer and follow the software package’s specific instructions:

    1. Download XAMPP: Go to the XAMPP official website and download the latest version of XAMPP for Windows.
    2. Install XAMPP: Double-click the downloaded file to start the installation process. Run the downloaded installer file and follow the on-screen instructions to install XAMPP. By default, XAMPP will be installed in the C:\xampp directory.
    3. Start XAMPP: After installation, open the XAMPP Control Panel from the Start menu or desktop shortcut. Start the Apache and MySQL modules by clicking on the “Start” buttons next to each module.
    4. Verify installation: To verify that XAMPP is working correctly, open a web browser and navigate to http://localhost. This should display the XAMPP welcome page.
    5. Create a virtual host: To create a virtual host, follow the steps outlined below.

    XAMPP should now be installed and configured on your machine. You’re ready to start developing and testing your websites locally.

    Note: The process of installing XAMPP or other local server software, such as MAMP or WAMP, may vary slightly depending on the operating system being used. For Mac and Linux operating systems, you can follow the installation instructions provided on the XAMPP website.

    See our other XAMPP-related tutorials for additional information on setting up XAMPP, upgrading XAMPP, troubleshooting XAMPP, and migrating WordPress from a XAMPP localhost to the web.

    Setting Up a Virtual Host

    Setting up a virtual host in a local development environment allows developers to run multiple websites on their local machine, each with its own unique URL. This provides a more realistic testing environment and makes it easier to switch between different projects.

    For the step-by-step guide below to set up a virtual host in your local development environment and start testing your websites:

    1. Open the Apache configuration file: Open the configuration file for your local server software. For this example, we’re using XAMPP, so open the Apache configuration file, typically located at /etc/httpd/conf/httpd.conf or C:\xampp\apache\conf\httpd.conf.

    2. Enable virtual hosting: Locate the section labeled “# Virtual Hosts” and uncomment the following line by removing the hash symbol (#) at the beginning of the line: #Include conf/extra/httpd-vhosts.conf.

    3. Configure the virtual host: Open the virtual host configuration file, typically located at /etc/httpd/conf/extra/httpd-vhosts.conf or C:\xampp\apache\conf\extra\httpd-vhosts.conf.

    4. Add a new virtual host: Add a new virtual host by creating a new block of code with the following format:

    ServerName example.local
    DocumentRoot "/path/to/document/root"
    <Directory "/path/to/document/root">
    AllowOverride All
    Require all granted

    Do this:

    • Replace “example.local” with the desired URL for the virtual host.
    • Replace “/path/to/document/root” with the full path to the document root directory for the virtual host.

    5. Update the hosts file: The hosts file maps domain names to IP addresses. To make the virtual host accessible via the URL you specified, you’ll need to add an entry to the hosts file. The hosts file is typically located at /etc/hosts or C:\Windows\System32\drivers\etc\hosts. Add a new line with the following format: 127.0.0.1 example.local. Replace “example.local” with the URL specified in the virtual host configuration. Save the changes to the configuration file.

    6. Restart Apache: Restart the Apache local web server to apply the changes.

    7. Test the virtual host: Test your virtual host by visiting the URL in a web browser. The browser should display the content of the document root directory for the virtual host.

    Creating a Database for Your Local WordPress Installation

    The next step before setting up a WordPress project locally is to create a database for your local development environment.

    Follow these step-by-step instructions to create a database in XAMPP:

    1. Open the XAMPP Control Panel: Open the XAMPP Control Panel from the Start menu or desktop shortcut. Make sure the Apache and MySQL modules are running.

    2. Access phpMyAdmin: To access phpMyAdmin, open a web browser and navigate to http://localhost/phpmyadmin. This will open the phpMyAdmin interface in your browser.

    3. Create a new database: In the phpMyAdmin interface, click on the “Databases” tab. In the “Create database” section, enter a name for your new database and select the “utf8mb4_general_ci” collation. Then, click on the “Create” button.

    4. Create a new user: To create a new user for the database, click on the “Users” tab and then the “Add user” button. In the “Add user” form, enter a username and password for the new user, and select “Local” as the host. Make sure to grant all privileges to the user by checking the “Grant all privileges on database” checkbox. Finally, click on the “Go” button.

    5. Save your details: Write down or save your database name, username and password. You will need these to connect the database to WordPress later.

    After completing the above steps, you will have successfully created a database for your local WordPress installation and local development environment.

    You can now use this database to store and manage your data as you develop and test your WordPress site locally.

    Have you completed all of the above steps?

    Installed local server software
    Set up virtual host
    Created database

    Great! Then let’s move on to the next step…

    Installing WordPress Locally

    Now that we have prepared our local environment, the next step is to download, install, and configure WordPress.

    Downloading and Installing WordPress on Local Server

    Follow the steps below to complete this process:

    1. Visit the WordPress website: Go to the official WordPress.org website and click on the “Download WordPress” button to download the latest version of WordPress.
    2. Extract the archive: The WordPress download will be a compressed ZIP file. Extract the contents of the archive to a directory on your computer.
    3. Move the extracted files to your local server: Move the contents of the extracted directory to the root directory of your local server. If you’re using XAMPP, for example, this is typically C:\xampp\htdocs on Windows or /Applications/XAMPP/htdocs on macOS.
    4. Create a database: (Note: if you have been following along, this step should already be done.) Before installing WordPress, you’ll need to create a database. You can do this using a tool like phpMyAdmin, which is included with most local server software like XAMPP and MAMP.
    5. Start the installation: Open your web browser and navigate to http://localhost/wordpress (or the equivalent URL for your local server). This will start the WordPress installation process.
    6. Choose the language: On the first screen, select your preferred language and click the “Continue” button.
    7. Fill in the database information: On the next screen, fill in the database information that you created in step 4. This includes the database name, database username, and database password.
    8. Fill in the site information: On the next screen, fill in the information for your local WordPress site. This includes the site title, username, password, and email address.
    9. Run the installation: Once you’ve filled in all the information, click the “Install WordPress” button to run the installation.
    10. Log in to your site: After the installation is complete, log in to your local WordPress site using the username and password you created in step 8 to start customizing and developing your local site.

    You have now successfully downloaded and installed WordPress.

    You can now start customizing and developing your site locally, with all the benefits of a local development environment, before deploying your site to a live server.

    Configuring wp-config.php File

    The wp-config.php file is a crucial component in the setup of a local WordPress installation and local development environment. This file contains configuration settings that control how WordPress interacts with your database and other important settings.

    If you have followed the installation instructions above, your database credentials will be automatically added to the wp-config.php file.

    If, for any reason, you need to manually configure the wp-config.php file, follow the instructions below:

    1. Create a wp-config.php file: If your local WordPress installation doesn’t already have a wp-config.php file, you can create one by copying the wp-config-sample.php file and renaming it to wp-config.php.

    2. Update database credentials: Open the wp-config.php file and update the following lines with the appropriate information:

    define( 'DB_NAME', 'database_name' );
    define( 'DB_USER', 'database_user' );
    define( 'DB_PASSWORD', 'database_password' );
    define( 'DB_HOST', 'localhost' );

    Replace database_name, database_user, and database_password with the values you used when creating the database and user in a previous step.

    3. Set the WordPress security keys: WordPress security keys add an extra layer of security to your site by encrypting information stored in cookies. You can generate a set of security keys at the official WordPress site. Copy the generated keys and paste them into your wp-config.php file, replacing the placeholder keys that are already there.

    4. Enable debugging: For local development, it’s useful to enable debugging in WordPress. This will provide more detailed error messages and warnings that can help you troubleshoot issues with your site. To enable debugging, add the following line to your wp-config.php file:

    define( 'WP_DEBUG', true );

    5. Save the changes: Once you have made the changes to the wp-config.php file, save the file and close it.

    Successfully configuring the wp-config.php file will ensure that your locally installed WordPress site is able to connect to the database, is secure, and provides helpful debugging information as you develop and test your site locally.

    Importing a Live WordPress Site to Local Environment

    Follow the steps below if you need to import a live WordPress site into your local environment:

    Exporting the Live Site’s Database

    To export the live site’s database, you’ll need to have access to the live site’s server.

    Here are the steps to export the live site’s database (note: different server environments will perform this differently, but most should follow a similar process):

    1. Log into your live server’s control panel.
    2. Access the database: The first step is to access the database of the live site. You can do this using a tool like phpMyAdmin, which is often provided by your web hosting provider. Look for a section called “Databases” and click on “phpMyAdmin.”
    3. Select the database: Once you’ve logged into phpMyAdmin, select the database for your live site from the left-side panel.
    4. Export the database: Click on the “Export” button to start the export process.
    5. Choose the export format: On the export screen, choose the “Quick” export method, select the “SQL” format and make sure that the “Structure” and “Data” options are selected.
    6. Download the export file: Click the “Go” button to download the export file to your computer.

    Importing the Database to the Local Server

    To import the live site’s database to your local server, make sure your chosen local server software is already installed on your computer.

    Here are the steps to import the live site’s database to your local server:

    1. Open phpMyAdmin in your local server software: Log into phpMyAdmin for your local server and select the database you created for your local WordPress installation.
    2. Import the database: Click on the “Import” button to import the data from the export file you just downloaded.
    3. Select the import file: On the import screen, click on the “Choose File” button, select the export file you just downloaded, and click the “Go” button to start the import process.

    Replacing URLs in the Database

    After importing the live site’s database, you will need to replace the URLs in the database to match your local development environment.

    Here are the steps to replace URLs in the database:

    1. Open phpMyAdmin in your local server software.
    2. Select the imported database from the left-side panel.
    3. Click on the “SQL” tab.
    4. Enter the following query in the text area:

    UPDATE wp_options SET option_value = replace(option_value, 'http://www.livesite.com', 'http://local.livesite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
    UPDATE wp_posts SET guid = replace(guid, 'http://www.livesite.com','http://local.livesite.com');
    UPDATE wp_posts SET post_content = replace(post_content, 'http://www.livesite.com', 'http://local.livesite.com');

    5. Replace “http://www.livesite.com” with the URL of your live site, and replace “http://local.livesite.com” with the URL of your local development environment.

    6. Click on the “Go” button to execute the query.

    Uploading the Live Site’s Files to the Local Environment

    To upload the live site’s files to the local environment, you will need to have FTP access to your live site’s server.

    Follow the steps below to upload the live site’s files to your local environment:

    1. Connect to your live site’s server using an FTP client such as FileZilla.
    2. Navigate to the root directory of your live site on the server.
    3. Download all the files to your local computer.
    4. Place the downloaded files in the root directory of your local development environment, which is usually located in the “htdocs” or “www” folder in XAMPP or other local server software.

    Notes:

    1. If you already have a WordPress installation, the above folder won’t be empty and you will be prompted to replace existing files and directories, so replace all files except for the wp-config.php file to keep the same configurations, including the connected databases which have been populated with the live site’s data.
    2. Before uploading the live site’s files to the local environment, you may need to change the file permissions to make the files writable by your local server software.
    3. Also, make sure to test your local WordPress backup before making any changes.

    That’s it! You have now successfully imported your live site into your local WordPress installation and local development environment.

    Developing and Testing on Local WordPress Site

    You’re finally ready to develop and test your site locally using the same data as your live site, giving you a true-to-life environment for testing and development.

    Let’s go through the process:

    Making Changes and Testing

    1. Log into the local WordPress site: Open your local WordPress site in your web browser and log in to the WordPress dashboard using your administrator credentials.
    2. Make changes to the site: You can make changes to your local WordPress site by editing themes, plugins, or custom code. Simply access these elements from the WordPress dashboard.
    3. Test changes: After making changes to your local WordPress site, it’s important to test the changes to make sure they work as expected. You can test changes by visiting the front-end of your site and checking that the changes have taken effect.

    Debugging

    1. Use the Debugging mode: WordPress has a built-in debugging mode that makes it easier to identify and resolve issues on your site. To enable the debugging mode, you need to add the following code to your wp-config.php file: define( 'WP_DEBUG', true );.
    2. Check the error logs: If you’re having issues with your local WordPress site, you can check the error logs to see if there are any error messages or warning messages that can help you identify the issue. The error logs can be found in the WordPress debug log file, which is located in the wp-content directory.
    3. Use debugging tools: There are a number of debugging tools and plugins available for WordPress that can help you identify and resolve issues on your site. For example, the Query Monitor plugin provides detailed information about database queries, plugin usage, and more. See this tutorial for help with debugging WordPress: Debugging WordPress: How To Use WP_Debug

    Testing Different Plugins and Themes

    Installing, activating, and testing plugins and themes on a local WordPress site works in exactly the same way as it does on any other regular WordPress site. So, make sure to do the following while in testing mode:

    1. Install plugins: Install plugins on your local WordPress site to add new features or functionality to your site. To install a plugin, log in to the WordPress dashboard, go to the Plugins section, and click on the Add New button.
    2. Activate plugins: Activate the plugin you’re testing after installing it to use it on your site. To activate a plugin, go to the Plugins section of the WordPress dashboard and click on the Activate button next to the plugin you want to use.
    3. Test plugins: After activating a plugin, it’s important to test the plugin to make sure it’s working as expected. Test plugins by visiting the front-end of your site and checking that the plugin has taken effect.
    4. Install themes: Install themes on your local WordPress site to change the appearance of your site. To install a theme, log in to the WordPress dashboard, go to the Appearance section, and click on the Themes button.
    5. Activate themes: Activate the theme after installing it to change your site’s appearance. To activate a theme, go to the Appearance section of the WordPress dashboard and click on the Activate button next to the theme you want to use.
    6. Test themes: After activating a theme, it’s important to test the theme to make sure it’s working as expected. Test themes by visiting the front-end of your site and checking that the theme has taken effect.

    Have you make all the changes you need, debugged issues, and tested different plugins and themes on your local site?

    Great! Now you’re ready to make your local WordPress site live.

    Deploying Local WordPress Site to Live Server

    The final step in this process is to export all of your local WordPress files and database to your live hosting environment and make sure that all of your site’s changes, configurations, and URLs are working on your live site.

    Exporting the Local Site’s Database

    Follow the steps below to export your local WordPress site to your live server:

    1. Log in to the local site’s database using PHPMyAdmin.
    2. Select the database you want to export.
    3. Go to the “Export” tab.
    4. Choose the “Quick” export method.
    5. Select the “SQL” format.
    6. Click “Go” to download the SQL file to your computer.

    Importing the Database to the Live Server

    Follow the steps below to import your local WordPress database’s export file into your live site:

    1. Log in to the live server’s database using PHPMyAdmin.
    2. Create a new database for the live site.
    3. Go to the new database and select the “Import” tab.
    4. Choose the exported SQL file from your local site.
    5. Click “Go” to import the database.

    Now that you have migrated the database over from your local site to your live site, let’s do the same for your site’s files.

    Uploading the Local Site’s Files to the Live Server

    Follow the steps below to upload your local WordPress site’s files into your live site:

    1. Prepare the files: Before uploading the local site’s files to the server, it’s a good idea to review and clean up the files. This may include removing any unnecessary files, such as backups or test files, to minimize the amount of data being uploaded.
    2. Connect to the server: You can connect to the server using a variety of methods, such as FTP or SFTP. You will need to use a client software, such as FileZilla, to connect to the server. You will need to provide your server host, username, and password to connect.
    3. Upload the files: Once you are connected to the server, you can upload the local site’s files to the server. You can upload the files in a number of ways, including uploading individual files or uploading the entire local site folder. Navigate to the root directory of the live site on the server. Upload all the local site’s files to the live site’s directory on the server, and replace the existing files if prompted.
    4. Update the database information: After uploading the files to the server, you will need to update the database information in the wp-config.php file to reflect the live site’s database information. Open the wp-config.php file in a text editor and update the database name, username, and password to match the live database.
    5. Update URLs in the database:  See the section below.
    6. Test the site: After uploading the local site’s files to the server, it’s a good idea to test the site to make sure everything is working correctly. This may involve testing the site’s functionality, links, and images to make sure they are working as expected.

    Updating URLs in the database

    You can update the URLs in your database using a text editor or by working directly in your database (make sure your database is fully backed up before making changes).

    Updating URLs Using a Text Editor

    Follow the steps below to update the URLs in your database using a text editor.

    1. Export the database: Before updating the URLs in the database, you will need to export the database. Use your database management tool (e.g. phpMyAdmin).
    2. Find and Replace the URLs: Once you have exported the database, you will need to find and replace the URLs in the database. You can do this using a text editor such as Sublime or Visual Studio Code. Search and replace the URLs, and make sure to replace the URLs carefully and thoroughly, including URLs in serialized data.
    3. Import the database: After updating the URLs in the database, you will need to import the database back into your local development environment. You can import the database using a database management tool, such as phpMyAdmin.
    4. Test the site: After importing the updated database, it’s a good idea to test the site to make sure everything is working correctly. This may involve testing the site’s functionality, links, and images to make sure they are working as expected.

    Updating URLs in the Database

    Follow the steps below to update the URLs directly in your database:

    1. Log in to the live site’s database using PHPMyAdmin.
    2. Select the live site’s database.
    3. Go to the “SQL” tab.
    4. Run the following SQL query to update the URLs:

    UPDATE wp_options SET option_value = replace(option_value, 'http://old-url', 'http://new-url') WHERE option_name = 'home' OR option_name = 'siteurl';
    UPDATE wp_posts SET guid = replace(guid, 'http://old-url','http://new-url');
    UPDATE wp_posts SET post_content = replace(post_content, 'http://old-url', 'http://new-url');

    Replace “old-url” with the URL of the local site and “new-url” with the URL of the live site.

    5. Click “Go” to run the query.
    6. This will update all references to the local site’s URL with the live site’s URL in the database, ensuring that all links and images on the live site work correctly.

    If you have followed the above steps correctly, the URLs in your database should have successfully updated. After these steps, your local WordPress site should now be fully functional on the live server. Make sure to thoroughly test the live site to ensure that all features are working correctly, and make any necessary adjustments to ensure a seamless transition from the local development environment to the live server.

    Local Development vs Webhost Staging Environment

    While WordPress local development provides a safe and efficient environment to build, edit, and test WordPress websites, you may decide to work in a webhost staging environment instead (here are some good reasons why you may not want to develop WordPress locally).

    Both local development environments and webhost staging environments, however, have their pros and cons.

    Here is a brief overview of the pros and cons of using a WordPress local development versus a webhost staging environment:

    Pros of Local Development Environment

    • Easy to Use: Local development environments are easy to use, even for beginner developers.
    • Flexibility: You have complete control over your local development environment, so you can configure it however you like.
    • Test Any Changes: With a local development environment, you can test any changes you make to your site without affecting the live version.

    Cons of Local Development Environment

    • Not a Live Environment: A local development environment is not a live environment, so you cannot test your site with live data.
    • Limited Resources: Your local machine may have limited resources, such as memory and processing power, which can affect your site’s performance.
    • Not a True Representation: A local development environment may not accurately represent a live server environment, so testing may not be 100% accurate.

    Pros of Webhost Staging Environment

    • Live Environment: A webhost staging environment is a live environment, so you can test your site with live data.
    • More Accurate Testing: A webhost staging environment is a more accurate representation of a live server environment, so testing is more reliable.
    • More Resources: A webhost staging environment typically has more resources available than a local development environment, so your site’s performance will be better.

    Cons of Webhost Staging Environment

    • Cost: Setting up a webhost staging environment can be expensive, as you have to pay for hosting and a domain name.
    • Not as Fast: A webhost staging environment is not as fast as a local development environment because it runs on a remote server.

    For smaller projects, a local development environment is a great option because it is free and easy to use. For larger projects, however, a webhost staging environment may be a better option because it is a live environment and provides more accurate testing.

    Ultimately, the choice between these two methods will depend on your individual needs, preferences, and hosting options.

    Note: We recommend avoiding shared hosting, and hosting on our Quantum plan instead for basic WordPress sites, but if you have reasons for choosing shared hosting, then check out our article on how to run WordPress local development on shared hosting.

    All WMU DEV hosting plans (except for Quantum) include a staging environment. Refer to our staging documentation for more details on the benefits of using a staging environment to develop and test WordPress sites.

    Go to source