Adding Categories and Tags into WordPress Pages

Wordpress CMS is a very popular one, but some features and settings are strange.

The most common question people creating content for websites based on this CMS ask is the following:

Why WordPress Posts have Category and Tag settings but WordPress Pages have neither Categories nor Tags?

Here is a quick fix:

// Allow Categories and Tags in GUI of Page Editor 
function add_taxonomies_to_pages() {
	register_taxonomy_for_object_type('category', 'page');
	register_taxonomy_for_object_type('post_tag', 'page');
add_action('init', 'add_taxonomies_to_pages');

// Add Pages into Categories and Tags Archives 
function category_and_tag_archives($query) {
	// If you have custom post types add them into this array
	$my_post_array = array('post', 'page'); 

	if ($query->get('category_name') || $query->get('cat'))
		$query->set('post_type', $my_post_array);

	if ($query->get('tag'))
		$query->set('post_type', $my_post_array);
if (!is_admin()) {
	add_action('pre_get_posts', 'category_and_tag_archives');

You can add this code directly into your WordPress theme (function.php or header.php file).

But a safer way is to use one of plugins allowing to execute PHP code (Code Snippets, PHP Snippets, and so on). In this case WordPress Pages will still have Categories and Tags even if somebody changes (or updates) the theme of your site 🙂

Backup of Firewall settings is Important

If you use a web server (no matter with Linux, Unix or Windows) you should keep it safe. The firewall is the first place where you need to setup the system security.

It is necessary to restrict access to the server by specific protocols and ports. More precisely, on the server firewalls you need to close all ports and open only the most necessary ones 🙂

Linux kernel firewall works with iptables space. You can manually make entries in the iptables configs (different files in /etc/ or /etc/sysconfig/ depending on the Linux version). If you use some visual management panel (Webmin, WHM, CPanel, Plesk, etc.) tuning the Linux firewall become a pleasure.

But independently of managing methods, do not forget to make a regular copies of the firewall settings! Accidental clicking of some button in control panel can suspend all the rules and make your server vulnerable. Deleting or modification of the configuration file by some hacking scripts can do the same.

In general, for servers on the Linux system, the regular backup of the iptables config files is a must do task for webmaster. Backups for security settings are usually scheduled on Unix and Windows servers too.

Backup firewall settings regularly and keep your web-servers secure!