Adding Custom Admin Notices & Error alert in WordPress

When developing plugins for WordPress, I seldom use the Settings API to build the plugin settings page instead, I build it from ground-up utilizing the Options API to store the plugin data to the database.Not quite long, I discovered I could use the function add_settings_error() — a member of … [Read more...]

Set Default Editor Mode (TinyMCE / HTML) in WordPress

I recently built a plugin where I needed WordPress to by default always set its editor to Text (HTML) mode and not tinyMCE.This is achievable using the undocumented filer wp_default_editor.To make TinyMCE always display by default, use the code below.[php] function set_default_editor() … [Read more...]

Introduction to WordPress Theme Customization API

As a WordPress user, you'd already be familiar with the impressive features that the CMS brings along. Theme Customization API is one such feature that has taken the WordPress theme customization world by a wave.In this tutorial, you'll get to know about the utilization of WordPress Theme … [Read more...]

How to Add Categories and Post Tags to WordPress Custom Post Type

If you created a custom post type in WordPress and couldn't find the categories and post tags taxonomies, do not fret because the solution is easy.To add categories and post tags to a custom post type, include the taxonomies argument to register_post_type().[php] function post_type_init() … [Read more...]

Detect Visual and Text Mode in WordPress TinyMCE Editor

For reason(s) best known to you, you might want to check if WordPress TinyMCE Editor is in visual (rich text) or text mode.The variable is_tinymce_active returns true if TinyMCE is in visual mode and false otherwise.[javascript] var is_tinymce_active = (typeof tinyMCE != "undefined") … [Read more...]

WordPress Filters Battle – authenticate vs wp_authenticate_user

WordPress provide developers with lots of Action and Filter hooks for modifying, changing and remove certain operation / functionality in its core.These filters: authenticate and wp_authenticate_user are similar in that they can both be used to perform additional validation/authentication any … [Read more...]

Redirect First Time Commenters to a Custom WordPress Page

For reasons best known to you, redirecting readers or site visitors commenting on your blog for the first time to say, a Thank You for Commenting page would be fascinating.The code snippet below does the job perfectly well.[php] function redirect_first_time_commenters( $url, $comment ) … [Read more...]