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: http://docs.woothemes.com/document/webhooks/.

Enable CORS for Nginx

Whom have worked with cross-origin HTTP requests knows that one of the actions to make this working is enable CORS in API’s webserver .

As I work with Nginx, the code that warns browsers (Firefox e Chrome) and allow pre-flight requests is presented below:


The flow of this browsers is: making a pre-flight request to test the webserver, before making the real request. The code above allow the cross-origin request flow goes ahead. You will need to implement this code between “location” block.

More informations in Enable CORS and here. Hope this useful.


Hide tabs from product page on WooCommerce

Hello guys. This is another quick article with a tip of WooCommerce. Sometimes we don’t want show the tabs of the product page on WooCommerce. To hide them, you need to put the code below at your functions.php file theme’s:


Hope it will be usefull. See you later.

WooCommerce related products by tag

This is my first post written in English and I am a bit nervous, because I am not a fluent writer/speaker yet. However, as the main goal of this blog is improve my English, let’s start the game.

This tip is oriented to change the way of related products of WordPress / WooCommerce stores are displayed. By default, related products are shown from relations category of products. But, my client wanted to control the feature using Tags. To get that, we have to make some changes. Let’s see:

1) At the child theme functions.php, I added a new function. The comments are self explanatory.


//New "Related Products" function for WooCommerce
function get_related_custom( $id, $limit = 5 ) {
    global $woocommerce;

    // Related products are found from category and tag
    $tags_array = array(0);
    $cats_array = array(0);

    // Get tags
    $terms = wp_get_post_terms($id, 'product_tag');
    foreach ( $terms as $term ) $tags_array[] = $term->term_id;

    // Get categories (removed / commented)
    $terms = wp_get_post_terms($id, 'product_cat');
    foreach ( $terms as $term ) $cats_array[] = $term->term_id;

    // Don't bother if none are set
    if ( sizeof($cats_array)==1 && sizeof($tags_array)==1 ) return array();

    // Meta query
    $meta_query = array();
    $meta_query[] = $woocommerce->query->visibility_meta_query();
    $meta_query[] = $woocommerce->query->stock_status_meta_query();

    // Get the posts
    $related_posts = get_posts( apply_filters('woocommerce_product_related_posts', array(
        'orderby'        => 'rand',
        'posts_per_page' => $limit,
        'post_type'      => 'product',
        'fields'         => 'ids',
        'meta_query'     => $meta_query,
        'tax_query'      => array(
            'relation'      => 'OR',
                'taxonomy'     => 'product_cat',
                'field'        => 'id',
                'terms'        => $cats_array
                'taxonomy'     => 'product_tag',
                'field'        => 'id',
                'terms'        => $tags_array
    ) ) );
    $related_posts = array_diff( $related_posts, array( $id ));
    return $related_posts;

2) After that, I copied the entire content of related.php (from theme > woocommerce > single-product > related.php) to a new file at child theme.

3) At last, I changed the call of function at related.php

a) of:

$related = $product->get_related($flatsome_opt['max_related_products']);

b) to:

$related = get_related_custom($product->id, $flatsome_opt['max_related_products']);

Voilá. It was easy, didn’t it? Now we have a new related products component that is filtered by tags.

See you later, with more articles about WordPress, Ruby on Rails and Django.