Redirect WooComerce to a custom URL after login

If you are sending a URL like:

Open woocommerce/myaccount/form-login.php and add:

<input type=”hidden” name=”redirect” value=”<?= $_GET[‘redirect_to’]; ?>”>

WooComerce: Restrict payment method by product category

This is a custom filter to restrict certain payment methods on the WooCommerce, considering the product categories.


function restrict_gateways($gateways){

    $payment_name = 'your_payment_id';
    $product_category = 'your_category_name';

    global $woocommerce;

    foreach ($woocommerce->cart->cart_contents as $key => $values ) {
        $terms = get_the_terms( $values['product_id'], 'product_cat' );
        if (! $terms) {
        foreach ($terms as $term) {
            if ( $term->name != $product_category ) {

    return $gateways;


How to `git clone` including submodules?

With version 1.7.1 of Git and later, you can use:

git clone --recursive git://
cd bar

For already cloned repositories, just use:

cd clonde-repository
git submodule update --init --recursive

How to add a git submodule?

To add another git repository as submodule to your main repository, just use this command:

cd repository
git submodule add git:// submodules-dir/bar

Disable Automatic Updates in WordPress

As any WordPress Developer, I love the updates from the contributors of the ecosystem. Their updates help me to avoid hacks and other knowing issues about the system.

But, sometimes these updates can break the entire theme. So, to avoid the automatic WordPress updater you can add the property below inside the wp-config.php:


Linux useful commands: “ls” command

Hi people, every wednesday I bring here quick tips to make your life easy in managing Linux environments. Today I choosed the the most used command on Linux enviroments, in my opinion.

The command “ls”

We use this command every time when working with command prompt. You can see some useful tips to work better with it:

1) Listing all files (including hidden) with directory, size, modified date and time, file or folder name and owner of file and it’s permission in human readable format.

$ ls -lsahF

2) Reversing the order

$ ls -lsahFr

3) Including sub-directories recursively

$ ls -lsahFR

4) Sorting by File Size

$ ls -lsahFS


WordPress Speed Optmization

Hi people. I am back here bringing a serie of articles with strategies to optimize the performance and speed of a WordPress installation. I will cover these topics every monday:

  • Webserver
  • Caching
  • CDN
  • Backend
  • Database
  • Memory Cache
  • Improvements on static files
  • And much more

To introduce these topics, I would like to talk a little bit about me and my experience. During the last years I have been working with WordPress and how to extract the maximum potential of servers.

This task is not so difficulty, because the WordPress system is not so heavy to load. But the problem is when people use your creativity to create a problematic environments. Lots of plugins, poorly code and million of static files to manage are the perfect combination to make your WordPress weeps.

So, I expect you here next monday to talk more about caching strategies. This journey is just beginning. See you later.

WooCommerce and Webhooks

The webhook system of WooCommerce, which is present since a few versions ago, got a good web interface to manage creation and interaction with hooks. For whom do not know what webhooks mean, we can summarize like:


It is a mechanism that you can monitor notification of systems, by using an API, usually allowing to register an URL which runs a program to interpret the received notifications.


With this system, it is possible to monitor events ocurred on WooCommerce. For example, we can monitor new orders and send alerts for sales team to get in touch (it was only a simple example, there is many actions available to monitor).

You can check the full documentation here: