Updates to latest WordPress version

Fixes for queries and additional things that didn’t work properly. Now it works with WordPress 3.9.