Redirecting all pages from the old domain to the new one

When you switch domains for a WordPress installation, you should think of not only the how to move the site, but how to keep your content reachable by search engine hits or referrals. 301 Redirect is what is expected of you, and the easy way to do it, even if both domains are still hitting […]

json_no_route when querying taxonomy with WP-API

To get a taxonomy, using WP-API, you should make a request to http://example.com/wp-json/taxonomies/category/ All is well, until you have a taxonomy with a dash(‘-‘) in its name – in my case, the taxonomy is called ‘event-categories’ – the default event taxonomy in the Events Manager plugin. So, a request to http://example.com/wp-json/taxonomies/event-categories/ responds with a “No […]

Get the visitor’s country by their IP

Basically the code is something like this:  

So we are using the GeoPlugin API to retrieve the Country code. You can also get the full country name, state, city, continent and some other stuff. Here is a simple dump of the data returned from the site:

For more info and explanations and […]

Displaying the shortcode from Custom post type content or Metabox

Whenever you try to display a shortcode through custom field you will get the text part and the shortcode function won’t be trigger.  To avoid this you can apply the following filter in your code:  

“the_custom_field” should be replaced by your own custom field name. Basically you can apply this filter to any […]

Prevent hotlinking on your media files

Whenever you want to ban/prevent hotlinking your media files and protect your server’s resources and bandwidth you may use the following snippet in the .htaccess file of your main directory of your site.

Just replace YOURSITE.YOURDOMAIN with your site and at the fourth row of the actual code (don’t mind the # comment line) […]