Welcome to WP Freelance, the best collection of WordPress code, guides and information to make awesome WordPress sites, especially for freelancers.

Work less, and earn more as a developer in the WordPress ecosystem. Choose who you work for, and when you work for them.

  • WP CLI Delete All Terms in Taxonomy

    wp term delete {taxonomy} $(wp term list {taxonomy} –fields=term_id)

  • Improve the WordPress Audio and Video Player with 4 lines of code

    WordPress styles the default audio and video elements, and frankly it’s not an improvement. Below is the code to turn the audio player from this into this Add the code to your theme functions.php file.

  • Disable xmlrpc.php and Secure your WordPress Website

    xmlrpc.php is part of WordPress that is rarely used by any site, but poses a security risk. There has been a high level of attacks targeting this file so my advice it so secure your WordPress website by disabling this file completely. You can do so by adding this code to the bottom of your…

  • Can’t connect to the clients FTP?

    Here are some tips Check the transcript log of your FTP client. In the example below the server was telling me that I needed to be using SSL/TLS, which did solve the problem.

  • Convert text lines to list items

    <?php // Get the points from the ACF field $points = get_sub_field(‘points’); // Add new line to each point $points = explode(“\n”, $points); // Now convert to HTML ?> <ul><?php foreach($points as $point) : ?> <li><?php echo $point ?></li><?php endforeach; ?> </ul>

  • WooCommerce Update Checklist

    WooCommerce is a powerful but complex system, and larger installations often have some additional plugins or custmisations. After updating the WooCommerce plugin, or any other related plugins, it’s important to test your store to ensure everything works as expected and any bugs are identified and fixed. Here’s a handy list to help get your store…

  • Hide the annoying outline for mouse users but preserves it for keyboard users

    CSS that get’s rid of the annoying outline for mouse users but preserves it for keyboard users, and is ignored by browsers that don’t support :focus-visible. :focus:not(:focus-visible) { outline: none } Source @LeaVerou

  • How to Disable WordPress PHP Error Messages

    Sometimes even with the WP_DEBUG setting set to false you will see PHP error messages. This is normally because of the PHP setup configuration on the server. If you are seeing warnings that are causing issues with your theme add the code below to your wp-config.php file and all errors will be hidden. ini_set(‘display_errors’, ‘Off’);ini_set(‘error_reporting’,…

  • How to change menu items to sentence case in WordPress

  • Mailtrap not working on live WordPress server (Siteground) – Gateway Timeout error

    If Mailtrap is not sending on your WordPress site and you are getting a Gateway Timeout error, try changing the Mailtrap SMTP port to 465. This worked for my Siteground hosted WordPress site. Ports 2525 and 25 would cause the Gateway Timeout error.