How to use the wp_parse_url() and wp_parse_str() functions

wp_parse_url() #wp_parse_url() wp_parse_url() is wrapper function for PHP’s parse_url() function that handles consistency in the return values across PHP versions. Example 1: #Example 1: Let’s extract the scheme, host, and path from the URL by using the wp_parse_url(). The output of the above code is below: array (size=3) ‘scheme’ => string ‘https’ (length=5) ‘host’

Understanding the WP CLI arguments

In a recent article, we learn about creating the first WP CLI Hello World program. If you read that article then you can skip some below steps. Now, We are going to understand the WP CLI arguments or $args parameter from the WP CLI command. First, we’ll create a simple plugin and then understand the

Create a first WP CLI Hello World Program

We learn how to install the WP CLI. Now, Let’s create a simple WP CLI hello world program. We are going to create a new plugin that contains the WP CLI hello world program. Create Empty Plugin #Create Empty Plugin Create a new folder wordpress-examples into plugins directory /wp-content/plugins/ Create a file wordpress-examples.php and add

Adding image sizes with add_image_size() in WordPress

Introduction #Introduction We can add custom image sizes with function add_image_size(). But, First, let’s discuss why we need custom images in WordPress? By default, WordPress provides 3 image sizes. Means, When we upload any image in WordPress media library then WordPress creates 3 image sizes for us. These image sizes are: Thumbnail (150×150) Medium (300×300)


How to fix error: To perform the requested action WordPress needs to access your web server

Overview #Overview WordPress will prompt you for FTP credentials If it does not have permission to write the files it needs to. Whenever this happens we can see the error: To perform the requested action, WordPress needs to access your web server. Please enter your FTP information to continue. If you do not remember your

Avoid Automatic Redirection or Canonical Redirection

Overview #Overview WordPress redirects the incoming links to the proper URL based on the site url. Search engines consider the link and to be two different URLs when they both go to the same location. This SEO enhancement prevents penalties for duplicate content by redirecting all incoming links to one or the other.

How to enable allow_url_fopen from the php.ini file?

Introduction #Introduction allow_url_fopen is a filesystem and streams configuration option. Which enables the URL-aware fopen() wrappers that enable accessing URL objects like files. If allow_url_fopen() is enabled then by default we can access remote files using the FTP or HTTP protocol. Also, extensions like zlib may register additional wrappers. Issue #Issue We could not use


How to Fix the ERROR: the “PHPCompatibilityWP” coding standard is not installed.

How to Check PHPCompatibilityWP exist? #How to Check PHPCompatibilityWP exist? To check the PHPCompatibilityWP coding standard is installed on your system use command phpcs -i E.g. phpcs -i You can see the result like below: The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz, Zend, WordPress, WordPress-Core, WordPress-Docs, WordPress-Extra and PHPCompatibility Maybe you

FIXED: PHP Unit test issue PHP Warning/Fatal error: Failed to open stream: No such file (mock-mailer.php) for windows

After setup the PHP unit test on your Windows operating system maybe you get below error: In file C:\Users\MaheshW\AppData\Local\Temp\wordpress-tests-lib\wp-tests-config.php line 7 has code: Here, ABSPATH return the invalid path. You can simply change the above code with below: NOTE: Here change the {USERNAME} with your own user name. To know the user name just open


Auto translate WordPress theme and plugin strings with WP CLI

How to use? #How to use? Create fresh WordPress setup. Clone the plugin wp-i18n into your /wp-content/plugins/ directory. Import the database latest.sql with WP CLI commnd as below:wp db import latest.sql Now use below commands to translate any plugin/theme from To translate the plugin use 2 WP CLI commands: Here, download_plugin_po & generate_plugin_po are