How deprecate code on WordPress Plugin

As you start to develop plugins to sell or distribute for free on the WordPress plugin repository you will see yourself in one of the worst situations as a product developer.

In order to improve your code you will need to let go of old code and introduce new stuff to the codebase.

You will face the following problem, how will you do it without breaking themes and other plugins that rely on your current code?

Using a Meta value on Post Title

I saw a tweet earlier today of a user asking how to solve common issue, how to use a single variable inside of the title of my WordPress posts, in this case events.

How to do it

To understand how to do this task you first need to see that these kind of variables can be used inside of title without been inserted manually on by applying a little concept called filter, which will allow you to hook to a WordPress method and apply X or Y function to solve your issue.

How to use AJAX on WordPress

If you already know what is an AJAX request please just jump right to the section where I will talk about how to start coding.

What is an AJAX request

First you will need to understand that an AJAX request is nothing more then a simple GET or POST to an URL that you defined, you will pass some parameters and this URL should answer you with some other data that you will be able to parse on the JavaScript and using it you will be able to give your users the needed visual feedback.

Challenging myself to blog on 2015

I saw a post on Brad Willians blog about doing a challenge on blogging, so I imagined why not? It should be a very good experience trying to write more.

On his post Brad said that he would do 100 posts this year and just to make it interesting I will do 101 (beat that!).

I love to talk about stuff, and writing is no different, but I always keep forgetting to do it, so I think creating a challenge for myself should help me be active.

My intention is to blog about personal stuff of my life, WordPress, general development and some Mac OS based content.

So let's start counting!

How to make WordPress Database Case Insensitive

When I started to work with WordPress I didn't know anything about how databases works or anything related to encoding and character set, but as I started into adventure myself on places like pre_get_posts, and the WP_Query filters such as posts_join and posts_where, I quickly found that understanding how the database works was a key to unlocking better performance.

Once I was trying to do a search on some User meta data and I didn't know why one of my results where not been shown as I expected so delving further and debugging I found that there an information called Collation which is the set of Rules that your database table will follow.

The problem was this meta data was a city value, and I did not have control over the user input so it needed to be case-insensitive, which was not happening because the Collation was set to be utf8_bin that will make your MySQL compare queries that involve LIKE via a Binary structure so it will A is not equal to a.

This case sensibility issue on WordPress databases or any MySQL is easy to solve, you just need to change the collation of the tables that you want to be insensitive by executing the following SQL query on your database.

ALTER TABLE `wp_posts` CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE `wp_postmeta` CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Where the _ci at the end will convert the Collation to be Case Insensitive, remember that changing the Collation of a table might lead you to have security problems of people trying to pose as Administrator account, which in WordPress is not the case because there are validations for that but if you are in another system you might want to double check.

WordCamp São Paulo 2014

No próximo sábado vou estar em São Paulo falando sobre como contribuir para o WordPress sendo você um desenvolvedor, designer, tradutor ou usuário!

Sendo a grande força da ferramenta a sua comunidade extremamente colaborativa e receptiva a novos membros, vamos nesses 40 minutos entender como funciona a participação e contribuição individual para que essa grande qualidade do WordPress seja feita de forma sólida e bem estruturada pela comunidade Brasileira.

Confira o resto da programação do WordCamp São Paulo 2014 e faça parte desse evento.

Espero você por lá!

Installing GCC on OS X Yosemite via Homebrew

Last week I decided to install Mac OS X Yosemite (v10.10), and as expected a lot of things changed under the hood on Mac OS, so things are still not as easy to install as they were on my Mavericks installation.

Almost all of the problems I faced so far I was able to find articles on how to solve them, but when I was trying to install [fswatch]( "Cross-platform file change monitor" "_blank") I had a problem with the GCC compiler.

After digging a bit on Homebrew's GitHub Issues I found that you can edit the GCC formula and apply a patch that will make it work on Yosemite.

The Error

When Homebrew was installing the Bootstrap (make bootstrap) the following error was presented on my terminal:

config.status: executing default commands
make[1]: *** [stage2-bubble] Error 2
make: *** [bootstrap] Error 2


These open issues may also help:
gcc: compatibility 10.10 (
gcc 4.8.3 bottle has invalid omp.h header (
MacOS.(gcc|clang|llvm)_version can return nil (


It's easy do resolve the issue, you only need:

brew edit gcc

Then you will find the following:

   require "formula"

    class Gcc < Formula
        def arch
            if Hardware::CPU.type == :intel
                if MacOS.prefer_64_bit?
            elsif Hardware::CPU.type == :ppc
                if MacOS.prefer_64_bit?

        def osmajor
            `uname -r`.chomp

Then add the code below the osmajor method definition:

        # edit by b.nelissen 20140805
        # tobinjones patch gcc
       patch do
            url ""
            sha1 "def0cb036a255175db86f106e2bb9dd66d19b702"

Now you will need to run brew install gcc again and you should be good to go.