Wordpress Developer Guide

What is Wordpress (AKA WP)

WordPress (WordPress.org) is a content management system (CMS) written in PHP …​ Source : Wikipidia

Sage Theme Framework (Free)

  • Aimed at developers.

  • Sage is a WordPress starter theme with a modern development workflow.

  • https://github.com/roots/sage

  • Sass for stylesheets

  • Modern JavaScript

  • Webpack for compiling assets, optimizing images, and concatenating and minifying files

  • Browsersync for synchronized browser testing

  • Blade as a templating engine

  • Controller for passing data to Blade templates

  • CSS framework (optional): Bootstrap 4, Bulma, Foundation, Tachyons, Tailwind

SiteOrigin Vantage (Freemium)

  • Works well with SiteOrigin Page Builder

Avada (Paid)

  • Priced at $60 with over 300,000 sales. (ToDo) Test & Provide more info.

Components.underscores.me theme generator by WP

  • Aimed at developers.

UnderStrap: Underscores starter theme + Bootstrap (Free)

  • Aimed at developers.

  • Has a sample child theme to get started quickly.

  • Aimed at developers and does not include pretty css for production sites.

  • Listed in a WP CLI command below for now.

WPMUDEV Plugins (Freemium)

  • Smush

  • HummingBird

  • Defender

https://themefuse.com (premium)

  • Pricing: $250 life time access & updates. Other options available.

Working with WP CLI (WordPress Command Line Interface)

Setting File permission

The recommended file permissions are 755 for folders & 644 for files.

To correct WordPress file permission, you can run the following commands in the terminal at the root level of the project (Usually public_html/)

find . -type d -exec chmod 755 {} +
find . -type f -exec chmod 644 {} +

WP CLI Commands

Download WP using WP CLI
wp core download
Install recommended plugins using WP CLI
wp plugin install \
classic-editor \
shortcodes-ultimate \
worker \
duplicate-post \
easy-wp-smtp \
contact-form-7 \
flamingo \
simple-image-sizes \
wordpress-seo \
updraftplus \
duplicator \

wp plugin install \
wp-smushit \
hummingbird-performance \
defender-security \

wp plugin install \
user-role-editor \

wp plugin install \

# Alternitaves
wp plugin install custom-sidebars
wp plugin install cc-child-pages
wp plugin install imagemagick-engine
wp plugin install post-smtp
wp plugin install w3-total-cache
Generate pages using WP CLI
wp post create --post_type=page --post_status="publish" --post_title="Home"
wp post create --post_type=page --post_status="publish" --post_title="About"
wp post create --post_type=page --post_status="publish" --post_title="Contact"
wp post create --post_type=page --post_status="publish" --post_title="Services"
wp post create --post_type=page --post_status="publish" --post_title="Terms & Conditions"
wp post create --post_type=page --post_status="publish" --post_title="Privacy Policy"
Create menus using WP CLI
wp menu create "Primary Menu"
wp menu location assign primary-menu primary
wp menu create "Secondary Menu"
wp menu create "Sidebar Menu"
wp menu create "Footer Menu"

WordPress Coding Standards

Moved to programming/conventions/ folder.

How to Create a WP Plugin?

Sample Plugin

  • Create a file under WP root /wp-content/plugins/my-plugin-name/my-plugin-name.php

  • Add then modify the following code as needed

     * Plugin Name: MyPluginName
     * Plugin URI: mypluginname.com
     * Description: myplugindescription
     * Version: 0.1.0
     * Author: My Name
     * Author URI: https://mywebsite.com
     * */
    // Function containing my code
    function my_plugin_name__function_name(){
    add_action('plugins_loaded', 'my_plugin_name__function_name');

WP Configuration

Sample wp-config.php

Note: Configs below used in test environment, it’s highly recommended you change them as needed for live websites.

// Load test environment config based on requested domain, else load SAFE live site config
if (
	key_exists('HTTP_HOST', $_SERVER) &&
   (($_SERVER['HTTP_HOST'] == "testing-domain.example.com.com") ||
) {
define('WP_SITEURL', 'https://example.com');
define('WP_HOME', WP_SITEURL);
define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', true);
define('WP_DEBUG_LOG', true);
define('SCRIPT_DEBUG', true);
define('DISALLOW_FILE_EDIT', false);
define('DISALLOW_FILE_MODS', false);
ini_set('display_errors', 1);

// Load SAFE live site config .

Control WP Updates Notifications

Add the following code to your theme or plugin to disable successful update notifications.

add_filter( 'auto_core_update_send_email', 'wpb_stop_auto_update_emails', 10, 4 );

function wpb_stop_update_emails( $send, $type, $core_update, $result ) {
if ( ! empty( $type ) && $type == 'success' ) {
return false;
return true;

WP Settings

  • Enable Pretty URL

  • Disable comments or at least limit them to loggin users till anti spam measures are taken.


Code Samples


Understanding WP Action & Filter Hooks

Commonly used action hooks.


Commonly used filter hooks.

WP Optimisation

  • Use PHP 7.2 with Opcache

  • GZip

  • Convert images to .webp

  • Image lazy loading

  • Long term file cache by adding expiry headers.

WP & MySQL Code Samples

Change WP Site URL

UPDATE wp_options SET option_value = replace(option_value, 'oldurl.com', 'newurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';UPDATE wp_posts SET guid = replace(guid, 'oldurl.com','newurl.com');
UPDATE wp_posts SET post_content = replace(post_content, 'oldurl.com', 'newurl.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'oldurl.com','newurl.com');