Tag Archives: PHP

Redirect and send "301 Moved Permanently" when permalink structure or slug has been changed WordPress plugin

WordPress logoBelieve it or not but changing WordPress permalink structure can actually temporarily remove your site from Google index. Also changing single page slug can do the same for that page. By default WordPress doesn't forgive these kind of changes and following old permalinks would usually result in "404 Not Found". In this article I'm bringing you WordPress plugin that enables you to redirect old permalinks to new ones after changing permalink structure or slug. This WordPress plugin will also send "301 Moved Permanently" headers to search engines and that would instruct Google and others to change their search index.

Continue reading

PHP function to get WordPress plugin version

Wordpress Logo BlueSo you're working on a WordPress plugin and you want to get current plugin version using PHP for display inside your plugin settings or on your plugin front end. Hardcoding the plugin version and changing it every release is no fun so in this article I'm bringing you my little PHP function I use with my Quick Chat for WordPress plugin to get current plugin version.

As always with WordPress development you need to be extra careful with your PHP and Javascript function names so you should prefix your every function with your plugin name. So here is PHP function you can use inside your plugin PHP file to get plugin version:

function plugin_name_get_version() {
    $plugin_data = get_plugin_data( __FILE__ );
    $plugin_version = $plugin_data['Version'];
    return $plugin_version;
}

Keep in mind that get_plugin_data() is available only on site backend. I guess it needs no additional explanation. Enjoy!

Change WordPress RSS Widget refresh interval

AskUbuntu LogoYesterday I've added AskUbuntu RSS Feed to TechyTalk.info sidebar to display feed of Ubuntu related questions with links to answers all provided by the Ubuntu community. This is really useful service. I've used WordPress RSS widget to display this RSS feed. The problem I've ran into was that WordPress RSS widget feed was refreshing only once in every 12 hours and for my purpose this is not often enough. In this article I will show you how to change WordPress RSS widget refresh interval.

Continue reading

Enable userdir Apache module on Ubuntu Linux and other Debian based distributions

Apache logoLately I've spent a lot of time on web programming using open source based technologies like PHP, MySQL and PostgreSQL. This works really great on Linux because every tool you need for web programing is right there a few keystrokes away using your favorite distribution and package manager. One essential thing you need to setup for web programming is localhost web server serving files inside your home directory. I've wrote about one method of making Apache web server work this way in my following article:

LAMP development in your home directory with suPHP module

In this article I will show you how to do the same thing in another way by enabling Apache module called userdir on Debian based distributions like Ubuntu. The official definition of userdir is that "this module allows user-specific directories to be accessed using the http://example.com/~user/ syntax". So lets get started...

Continue reading